LoginSignup
1
3

More than 5 years have passed since last update.

rbenvでいまさらruby1.9.2を入れる方法

Posted at

概要

rbenvでruby1.9.2を入れる方法です。EOLが過ぎているものの入れ方を書いて誰得な内容ですが、あるプロダクトの旧バージョンの動作を確認したいなど探し求めている人も居ると思い書きました。ここでは1.9.2-p290の例ですが、他のパッチレベルでも同じエラーであれば入れられると思います。 /usr/local/rbenv にインストールしているのでrootで作業していますが、よくある /home/(個人ユーザ)/.rbenvにインストールしている場合はrootじゃなくても作業できると思います。

現象

通常のインストール方法ではこけます。

# rbenv install 1.9.2-p290
================================================
Downloading yaml-0.1.6.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/7da6971b4bd08a986dd2a61353bc422362bd0edcc67d7ebaac68c95f74182749
Installing yaml-0.1.6...
Installed yaml-0.1.6 to /usr/local/rbenv/versions/1.9.2-p290

Downloading ruby-1.9.2-p290.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p290.tar.bz2
Installing ruby-1.9.2-p290...

WARNING: ruby-1.9.2-p290 is past its end of life and is now unsupported.
It no longer receives bug fixes or critical security updates.


BUILD FAILED (CentOS Linux 7 using ruby-build 20160913-17-g9a5d431)

Inspect or clean up the working tree at /tmp/ruby-build.20161213184049.27185
Results logged to /tmp/ruby-build.20161213184049.27185.log

Last 10 log lines:
                             ^
ossl_pkey_ec.c:819:29: 備考: 未宣言の識別子は出現した各関数内で一回のみ報告されます
ossl_pkey_ec.c: 関数 ‘ossl_ec_group_set_seed’ 内:
ossl_pkey_ec.c:1114:89: 警告: 符号付きと符号無しの整数式の間での比較です [-Wsign-compare]
     if (EC_GROUP_set_seed(group, (unsigned char *)RSTRING_PTR(seed), RSTRING_LEN(seed)) != RSTRING_LEN(seed))
                                                                                         ^
make[1]: *** [ossl_pkey_ec.o] エラー 1
make[1]: *** 未完了のジョブを待っています....
make[1]: ディレクトリ `/tmp/ruby-build.20161213184049.27185/ruby-1.9.2-p290/ext/openssl' から出ます
make: *** [mkmain.sh] エラー 1
================================================

作業内容

以下のようにするとインストールできます。

### パッチ作成
# vi ruby1.9.2.patch
# cat ruby1.9.2.patch
================================================
*** ext/openssl/ossl_pkey_ec.c  2015-07-10 00:18:48.945077759 +0900
--- ext/openssl/ossl_pkey_ec.c  2015-07-10 00:20:47.112714473 +0900
***************
*** 761,768 ****
--- 761,770 ----
                  method = EC_GFp_mont_method();
              } else if (id == s_GFp_nist) {
                  method = EC_GFp_nist_method();
+                #if !defined(OPENSSL_NO_EC2M)
              } else if (id == s_GF2m_simple) {
                  method = EC_GF2m_simple_method();
+                #endif
              }

              if (method) {
***************
*** 815,822 ****
--- 817,826 ----

              if (id == s_GFp) {
                  new_curve = EC_GROUP_new_curve_GFp;
+                #if !defined(OPENSSL_NO_EC2M)
              } else if (id == s_GF2m) {
                  new_curve = EC_GROUP_new_curve_GF2m;
+                #endif
              } else {
                  rb_raise(rb_eArgError, "unknown symbol, must be :GFp or :GF2m");
              }
================================================

### インストール
# cat ruby1.9.2.patch | rbenv install --patch 1.9.2-p290
================================================
Downloading yaml-0.1.6.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/7da6971b4bd08a986dd2a61353bc422362bd0edcc67d7ebaac68c95f74182749
Installing yaml-0.1.6...
Installed yaml-0.1.6 to /usr/local/rbenv/versions/1.9.2-p290

Downloading ruby-1.9.2-p290.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p290.tar.bz2
Installing ruby-1.9.2-p290...
patching file ext/openssl/ossl_pkey_ec.c

WARNING: ruby-1.9.2-p290 is past its end of life and is now unsupported.
It no longer receives bug fixes or critical security updates.

Installed ruby-1.9.2-p290 to /usr/local/rbenv/versions/1.9.2-p290

Downloading rubygems-1.8.23.tgz...
-> https://dqw8nmjcqpjn7.cloudfront.net/e4a1c6bbaac411eaab94deae78228b7584033a1f10a022f52bffa9613aa29061
Installing rubygems-1.8.23...
Installed rubygems-1.8.23 to /usr/local/rbenv/versions/1.9.2-p290
================================================

### 確認
# rbenv versions
================================================
  1.9.2-p290
* 2.3.1 (set by /usr/local/rbenv/version)
================================================

参考

1
3
0

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
1
3