LoginSignup
24
25

More than 5 years have passed since last update.

rbenvで1.8.7をインストールする際のエラーの対処法

Last updated at Posted at 2014-04-23

ちょっと訳あってどうしても1.8.7をインストールする必要があったんですが
centOS6.5でopensslをアップデートしてから(?)rbenvで1.8.7のインストールが失敗するようになりました。
どうもrbenvのバグではなくRubyのopenssl拡張のバグらしい。
ということでrbenvの作者のsstephensonは以下のようにパッチ当ててインストールしたらええがなとGitHubでおっしゃってます。

$ curl -fsSL https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/41808/diff?format=diff | filterdiff -x ChangeLog | rbenv install --patch 2.0.0-p247

2.0.0-p247 (and lower) と書いてあったのでlowerっつーことは1.8.7でもこのパッチ当てていいのかなと思い試してみたところ

$ curl -fsSL https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/41808/diff?format=diff | filterdiff -x ChangeLog | rbenv install --patch 1.8.7-p375

Installing ruby-1.8.7-p375...
patching file ext/openssl/ossl_pkey_ec.c
Hunk #1 succeeded at 757 (offset -5 lines).
Hunk #2 succeeded at 813 with fuzz 2 (offset -6 lines).
can't find file to patch at input line 33
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|Index: test/openssl/test_pkey_ec.rb
|===================================================================
|--- test/openssl/test_pkey_ec.rb   (revision 41807)
|+++ test/openssl/test_pkey_ec.rb   (revision 41808)
--------------------------
File to patch:

あかんわ、うまくいかね(^ω^;)
test/openssl/test_pkey_ec.rbが見つからないってこと?
とにかくパスを求められてしまい何を入力してもだめ。

そもそも1.8.7にtest/openssl/test_pkey_ec.rbなんてないんじゃないか?と思って
-x test/openssl/test_pkey_ec.rb を付けて無視してみたところ

$ curl -fsSL https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/41808/diff?format=diff | filterdiff -x ChangeLog -x test/openssl/test_pkey_ec.rb | rbenv install --patch 1.8.7-p375

Checking out http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8_7...
Installing ruby-1.8.7-p375...
patching file ext/openssl/ossl_pkey_ec.c
Hunk #1 succeeded at 757 (offset -5 lines).
Hunk #2 succeeded at 813 with fuzz 2 (offset -6 lines).
Installed ruby-1.8.7-p375 to /usr/local/rbenv_data/versions/1.8.7-p375

Downloading rubygems-1.6.2.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/0c95a9869914ba1a45bf71d3b8048420
Installing rubygems-1.6.2...
Installed rubygems-1.6.2 to /usr/local/rbenv_data/versions/1.8.7-p375

$ rbenv versions
  1.8.7-p375
  2.0.0-p451
* 2.1.1 (set by /usr/local/rbenv_data/version)

うまくいったみたい
(^ω^;)おかえり1.8.7
rbenv作者のヒゲ男爵はマジ神。

24
25
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
24
25