【问题标题】:OpenSSL compilation error installing Ruby on Mint 18在 Mint 18 上安装 Ruby 时出现 OpenSSL 编译错误
【发布时间】:2016-12-18 02:13:10
【问题描述】:

我已经在 Windows 下的 VM 上安装了 Linux Mint 18。当我尝试安装一些 rubies 时,我不断在该过程的同一点收到错误。我正在使用 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 linux-mint


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-09-29
      • 1970-01-01
      • 2013-06-15
      • 2013-03-08
      • 1970-01-01
      • 2014-02-07
      • 2013-11-02
      • 2012-06-11
      相关资源
      最近更新 更多