在Mint 18上安装Ruby的OpenSSL编译错误

时间:2016-12-18 02:13:10

标签: ruby linuxmint mint

我在Windows下的VM上安装了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!

1 个答案:

答案 0 :(得分:0)

我试图弄清楚这几个小时,并在发布后立即找到答案。希望它可以帮助别人。

某些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。

相关问题