未定义的符号:SSLv3_method - .../openssl.so with Ruby and ArchLinux

Undefined symbol: SSLv3_method - .../openssl.so with Ruby and ArchLinux

ArchLinux 上最近的 OpenSSL 更新中断了 Ruby,因为后者依赖于前者支持的 SSLv3。 Ruby 使用 OpenSSL 的代码将在它们终止时出现如下错误,从而揭示问题:

openssl.so: undefined symbol: SSLv3_method - .../openssl.so (LoadError)

我将 Ruby 的多个版本与 RVM 一起使用,该问题适用于所有版本。

我遇到问题的 OpenSSL 版本是 1.0.2h,但我相信它是在 1.0.2g 中引入的。版本 1.0.2f 工作正常。

如何解决兼容性问题(不降级 OpenSSL)?

问题是由于从 this commit 开始构建的 ArchLinux OpenSSL 包没有 SSLv3 支持。我相信在其他发行版中也做过类似的事情,例如 Ubuntu.

RVM 环境中的解决方案是重新安装将重建它们的 Rubies(您可能还希望更新到最新的 rvm):

$ rvm get head        # optional, if you want to!
$ rvm reinstall all   # or a specifc ruby version instead of 'all'

但是,较旧的红宝石仍然会失败,并出现如下编译错误:

Error running '__rvm_make -j1'
ossl_ssl.c:143:27: error: ‘SSLv3_client_method’ undeclared here (not in a function)

这是 discussed with the RVM team who have suggested installing this Ruby patch 允许旧红宝石建造的:

$ curl https://github.com/ruby/ruby/commit/801e1fe46d83c856844ba18ae4751478c59af0d1.diff > openssl.patch
$ rvm install --patch ./openssl.patch 1.9.3-p194

我使用此补丁成功构建了 ruby-1.9.3-p194ruby-2.0.0-p247ruby-2.2.1