エラー内容
rbenvでRuby2.0.0-p195をインストールしようとしたら次のエラーが出てインストールができなかった。
# rbenv install 2.0.0-p195
Downloading yaml-0.1.6.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/7da6971b4bd08a986dd2a61353bc422362bd0edcc67d7ebaac68c95f74182749
Installing yaml-0.1.6...
Installed yaml-0.1.6 to /root/.rbenv/versions/2.0.0-p195
Downloading ruby-2.0.0-p195.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p195.tar.bz2
Installing ruby-2.0.0-p195...
WARNING: ruby-2.0.0-p195 is past its end of life and is now unsupported.
It no longer receives bug fixes or critical security updates.
BUILD FAILED (CentOS release 6.8 (Final) using ruby-build 20170112)
Inspect or clean up the working tree at /tmp/ruby-build.20170114060145.4940
Results logged to /tmp/ruby-build.20170114060145.4940.log
Last 10 log lines:
ossl_pkey_ec.c:821: error: for each function it appears in.)
make[2]: *** [ossl_pkey_ec.o] エラー 1
make[2]: ディレクトリ `/tmp/ruby-build.20170114060145.4940/ruby-2.0.0-p195/ext/openssl' から出ます
make[1]: *** [ext/openssl/all] エラー 2
make[1]: *** 未完了のジョブを待っています....
installing default pathname libraries
linking shared-object pathname.so
make[2]: ディレクトリ `/tmp/ruby-build.20170114060145.4940/ruby-2.0.0-p195/ext/pathname' から出ます
make[1]: ディレクトリ `/tmp/ruby-build.20170114060145.4940/ruby-2.0.0-p195' から出ます
make: *** [build-ext] エラー 2
ログが出力されている/tmp/ruby-build.20170114060145.4940.logの内容は次のとおりだった。
(略)
compiling ossl_pkey_ec.c
ossl_pkey_ec.c: In function ‘ossl_ec_group_initialize’:
ossl_pkey_ec.c:766: 警告: implicit declaration of function ‘EC_GF2m_simple_method’
ossl_pkey_ec.c:766: 警告: assignment makes pointer from integer without a cast
ossl_pkey_ec.c:821: error: ‘EC_GROUP_new_curve_GF2m’ undeclared (first use in this function)
ossl_pkey_ec.c:821: error: (Each undeclared identifier is reported only once
ossl_pkey_ec.c:821: error: for each function it appears in.)
make[2]: *** [ossl_pkey_ec.o] エラー 1
make[2]: ディレクトリ `/tmp/ruby-build.20170114060145.4940/ruby-2.0.0-p195/ext/openssl' から出ます
make[1]: *** [ext/openssl/all] エラー 2
make[1]: *** 未完了のジョブを待っています....
installing default pathname libraries
linking shared-object pathname.so
make[2]: ディレクトリ `/tmp/ruby-build.20170114060145.4940/ruby-2.0.0-p195/ext/pathname' から出ます
make[1]: ディレクトリ `/tmp/ruby-build.20170114060145.4940/ruby-2.0.0-p195' から出ます
make: *** [build-ext] エラー 2
対応
これはRubyのバグで、パッチを適用すれば良い。
-
パッチ適用のためパッケージをインストール
# yum install patchutils patch
-
パッチを適用
# curl -fsSL "https://github.com/ruby/ruby/commit/0d58bb55985e787364b0235e5e69278d0f0ad4b0.patch" | filterdiff -x a/ChangeLog | rbenv install --patch 2.0.0-p195