在 Mint 18 上安装 Ruby 的 OpenSSL 编译错误
OpenSSL compilation error installing Ruby on Mint 18
我已经在 Windows 下的虚拟机上安装了 Linux Mint 18。当我尝试安装一些红宝石时,我在过程的同一点不断收到错误消息。我正在使用 ruby-install,但尝试了 ruby-build 也得到了相同的结果。我猜他们基本上在做同样的事情。
我需要安装 ruby 1.9.3 才能处理一个旧项目,但它失败了,p448 和 p551。一些 Ruby 2.xs 也失败了。我已经得到 2.1.9p490 来完全编译。
根据我发现的其他建议,我确保已安装 openssl 和 libssl-dev,并且是最新版本。谁能告诉我这是怎么回事以及如何解决?
这是它失败的地方:
compiling ossl_ssl.c
ossl_ssl.c:116:27: error: ‘SSLv3_method’ undeclared here (not in a function)
OSSL_SSL_METHOD_ENTRY(SSLv3),
^
ossl_ssl.c:106:69: note: in definition of macro ‘OSSL_SSL_METHOD_ENTRY’
#define OSSL_SSL_METHOD_ENTRY(name) { #name, (SSL_METHOD *(*)(void))name##_method }
^
ossl_ssl.c:117:27: error: ‘SSLv3_server_method’ undeclared here (not in a function)
OSSL_SSL_METHOD_ENTRY(SSLv3_server),
^
ossl_ssl.c:106:69: note: in definition of macro ‘OSSL_SSL_METHOD_ENTRY’
#define OSSL_SSL_METHOD_ENTRY(name) { #name, (SSL_METHOD *(*)(void))name##_method }
^
ossl_ssl.c:118:27: error: ‘SSLv3_client_method’ undeclared here (not in a function)
OSSL_SSL_METHOD_ENTRY(SSLv3_client),
^
ossl_ssl.c:106:69: note: in definition of macro ‘OSSL_SSL_METHOD_ENTRY’
#define OSSL_SSL_METHOD_ENTRY(name) { #name, (SSL_METHOD *(*)(void))name##_method }
^
ossl_ssl.c: In function ‘ossl_sslctx_session_new_cb’:
ossl_ssl.c:382:35: warning: variable ‘ret_obj’ set but not used [-Wunused-but-set-variable]
VALUE ary, ssl_obj, sess_obj, ret_obj;
^
ossl_ssl.c: In function ‘ossl_sslctx_session_remove_cb’:
ossl_ssl.c:431:38: warning: variable ‘ret_obj’ set but not used [-Wunused-but-set-variable]
VALUE ary, sslctx_obj, sess_obj, ret_obj;
^
ossl_ssl.c: In function ‘ssl_servername_cb’:
ossl_ssl.c:508:25: warning: variable ‘ret_obj’ set but not used [-Wunused-but-set-variable]
VALUE ary, ssl_obj, ret_obj;
^
Makefile:269: recipe for target 'ossl_ssl.o' failed
make[2]: *** [ossl_ssl.o] Error 1
make[2]: Leaving directory '/usr/local/src/ruby-1.9.3-p448/ext/openssl'
exts.mk:126: recipe for target 'ext/openssl/all' failed
make[1]: *** [ext/openssl/all] Error 2
make[1]: Leaving directory '/usr/local/src/ruby-1.9.3-p448'
uncommon.mk:178: recipe for target 'build-ext' failed
make: *** [build-ext] Error 2
!!! Compiling ruby 1.9.3-p448 failed!
我花了好几个小时想明白这个问题,并在发布后立即找到了答案。希望对其他人有帮助。
某些 Ruby 版本与某些 OpenSSL 版本之间存在问题。解决方法是为您尝试安装的 Ruby 版本找到补丁。我找到了 1.9.3(我需要的)以外的许多版本的补丁,所以它们就在那里。 (无论如何我都试过了,但是在尝试安装 1.9.3 时修补总是失败。)
终于在 archlinux 论坛的讨论中找到了 1.9.3 的正确补丁。
https://www.reddit.com/r/archlinux/comments/49bw8j/rvm_fails_to_compile_ruby_with_openssl_102g3/
此处讨论导致正确的补丁:
https://gist.github.com/anonymous/679228bc324d6fdd3074
下载补丁,然后在使用您选择的 Ruby 安装程序编译时应用它。他们都有应用补丁的开关。
有了这个补丁,我能够在我的系统上成功安装 ruby-1.9.3-p551。
我已经在 Windows 下的虚拟机上安装了 Linux Mint 18。当我尝试安装一些红宝石时,我在过程的同一点不断收到错误消息。我正在使用 ruby-install,但尝试了 ruby-build 也得到了相同的结果。我猜他们基本上在做同样的事情。
我需要安装 ruby 1.9.3 才能处理一个旧项目,但它失败了,p448 和 p551。一些 Ruby 2.xs 也失败了。我已经得到 2.1.9p490 来完全编译。
根据我发现的其他建议,我确保已安装 openssl 和 libssl-dev,并且是最新版本。谁能告诉我这是怎么回事以及如何解决?
这是它失败的地方:
compiling ossl_ssl.c
ossl_ssl.c:116:27: error: ‘SSLv3_method’ undeclared here (not in a function)
OSSL_SSL_METHOD_ENTRY(SSLv3),
^
ossl_ssl.c:106:69: note: in definition of macro ‘OSSL_SSL_METHOD_ENTRY’
#define OSSL_SSL_METHOD_ENTRY(name) { #name, (SSL_METHOD *(*)(void))name##_method }
^
ossl_ssl.c:117:27: error: ‘SSLv3_server_method’ undeclared here (not in a function)
OSSL_SSL_METHOD_ENTRY(SSLv3_server),
^
ossl_ssl.c:106:69: note: in definition of macro ‘OSSL_SSL_METHOD_ENTRY’
#define OSSL_SSL_METHOD_ENTRY(name) { #name, (SSL_METHOD *(*)(void))name##_method }
^
ossl_ssl.c:118:27: error: ‘SSLv3_client_method’ undeclared here (not in a function)
OSSL_SSL_METHOD_ENTRY(SSLv3_client),
^
ossl_ssl.c:106:69: note: in definition of macro ‘OSSL_SSL_METHOD_ENTRY’
#define OSSL_SSL_METHOD_ENTRY(name) { #name, (SSL_METHOD *(*)(void))name##_method }
^
ossl_ssl.c: In function ‘ossl_sslctx_session_new_cb’:
ossl_ssl.c:382:35: warning: variable ‘ret_obj’ set but not used [-Wunused-but-set-variable]
VALUE ary, ssl_obj, sess_obj, ret_obj;
^
ossl_ssl.c: In function ‘ossl_sslctx_session_remove_cb’:
ossl_ssl.c:431:38: warning: variable ‘ret_obj’ set but not used [-Wunused-but-set-variable]
VALUE ary, sslctx_obj, sess_obj, ret_obj;
^
ossl_ssl.c: In function ‘ssl_servername_cb’:
ossl_ssl.c:508:25: warning: variable ‘ret_obj’ set but not used [-Wunused-but-set-variable]
VALUE ary, ssl_obj, ret_obj;
^
Makefile:269: recipe for target 'ossl_ssl.o' failed
make[2]: *** [ossl_ssl.o] Error 1
make[2]: Leaving directory '/usr/local/src/ruby-1.9.3-p448/ext/openssl'
exts.mk:126: recipe for target 'ext/openssl/all' failed
make[1]: *** [ext/openssl/all] Error 2
make[1]: Leaving directory '/usr/local/src/ruby-1.9.3-p448'
uncommon.mk:178: recipe for target 'build-ext' failed
make: *** [build-ext] Error 2
!!! Compiling ruby 1.9.3-p448 failed!
我花了好几个小时想明白这个问题,并在发布后立即找到了答案。希望对其他人有帮助。
某些 Ruby 版本与某些 OpenSSL 版本之间存在问题。解决方法是为您尝试安装的 Ruby 版本找到补丁。我找到了 1.9.3(我需要的)以外的许多版本的补丁,所以它们就在那里。 (无论如何我都试过了,但是在尝试安装 1.9.3 时修补总是失败。)
终于在 archlinux 论坛的讨论中找到了 1.9.3 的正确补丁。
https://www.reddit.com/r/archlinux/comments/49bw8j/rvm_fails_to_compile_ruby_with_openssl_102g3/
此处讨论导致正确的补丁:
https://gist.github.com/anonymous/679228bc324d6fdd3074
下载补丁,然后在使用您选择的 Ruby 安装程序编译时应用它。他们都有应用补丁的开关。
有了这个补丁,我能够在我的系统上成功安装 ruby-1.9.3-p551。