LoginSignup
1
2

More than 5 years have passed since last update.

CentOSでRuby 2.2.1をインストールする際につまづいたこと

Posted at

最近さくらVPSを個人で契約しました。
そのセットアップの際につまづいたことのメモです。

環境

・CentOS 6 x86_64
・rbenv 0.4.0-146-g7ad01b2
・ruby-build最新版
・Linuxbrew導入済み

Ruby2.2.1をインストール

簡単にできるはずだったのが、つまづいた。

make[3]: ディレクトリ `/tmp/ruby-build.20150321134130.29283/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.20150321134130.29283/ruby-2.2.1/ext/fiddle' から出ます
make[1]: *** [ext/fiddle/all] エラー 2
make[1]: ディレクトリ `/tmp/ruby-build.20150321134130.29283/ruby-2.2.1' から出ます
make: *** [build-ext] エラー 2

logの中身を見てみると、

/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

libffiというパッケージがインストールされていないため
このようなエラーがでているみたい。

なので、libffiをインストール。

$ sudo yum install libffi-devel

Ruby2.2.1をインストールし直す。

$ rbenv install 2.2.1

できない!!
OpenSSL関係のエラーだったので、

$ brew install openssl

でopensslをインストール。
再度、

$ rbenv install 2.2.1

最後に

$ rbenv global 2.2.1

と指定すれば終了です。
おつかれさまでしした。

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