AKAI TSUKI

System development or Technical something

install Ruby 2.2.1 by rbenv.

rbenvを利用して、Ruby 2.2.1をインストールしようとしたら
エラーでたんですけどー。

[root@localhost ~]# rbenv install 2.2.1
Downloading ruby-2.2.1.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/5a4de38068eca8919cb087d338c0c2e3d72c9382c804fb27ab746e6c7819ab28
Installing ruby-2.2.1...

BUILD FAILED (CentOS release 6.5 (Final) using ruby-build 20150319zf)

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

Last 10 log lines:
make[3]: ディレクトリ `/tmp/ruby-build.20150329001343.2834/ruby-2.2.1/ext/fiddle/libffi-3.2.1' から出ます
linking shared-object fiddle.so
/usr/bin/ld: ./libffi-3.2.1/.libs/libffi.a(raw_api.o): relocation R_X86_64_32 against `.text' can not be used when making a shared object; recompile with -fPIC
./libffi-3.2.1/.libs/libffi.a: could not read symbols: Bad value
collect2: ld はステータス 1 で終了しました
make[2]: *** [../../.ext/x86_64-linux/fiddle.so] エラー 1
make[2]: ディレクトリ `/tmp/ruby-build.20150329001343.2834/ruby-2.2.1/ext/fiddle' から出ます
make[1]: *** [ext/fiddle/all] エラー 2
make[1]: ディレクトリ `/tmp/ruby-build.20150329001343.2834/ruby-2.2.1' から出ます
make: *** [build-ext] エラー 2
[root@localhost ~]#

libffiっていうのでエラーが出ているようです。

[root@localhost ~]# yum install libffi-devel
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: www.ftp.ne.jp
 * epel: ftp.kddilabs.jp
 * extras: www.ftp.ne.jp
 * updates: www.ftp.ne.jp
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package libffi-devel.x86_64 0:3.0.5-3.2.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================
 Package                        Arch                     Version                           Repository              Size
========================================================================================================================
Installing:
 libffi-devel                   x86_64                   3.0.5-3.2.el6                     base                    18 k

Transaction Summary
========================================================================================================================
Install       1 Package(s)

Total download size: 18 k
Installed size: 21 k
Is this ok [y/N]: y
Downloading Packages:
libffi-devel-3.0.5-3.2.el6.x86_64.rpm                                                            |  18 kB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : libffi-devel-3.0.5-3.2.el6.x86_64                                                                    1/1
  Verifying  : libffi-devel-3.0.5-3.2.el6.x86_64                                                                    1/1

Installed:
  libffi-devel.x86_64 0:3.0.5-3.2.el6

Complete!
[root@localhost ~]# 


もう一度インストールしてみます。

[root@localhost ~]# rbenv install 2.2.1
Downloading ruby-2.2.1.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/5a4de38068eca8919cb087d338c0c2e3d72c9382c804fb27ab746e6c7819ab28
Installing ruby-2.2.1...
Installed ruby-2.2.1 to /root/.rbenv/versions/2.2.1

[root@localhost ~]# rbenv global 2.2.1
[root@localhost ~]# ruby -v
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux]
[root@localhost ~]#

無事 Ruby 2.2.1がインストールできました。