LoginSignup
10
9

More than 5 years have passed since last update.

Vagrant+CentOS7にrbenv+ruby-buildでruby2.2.0をインストールしようとしたらエラーでた対策

Last updated at Posted at 2015-02-14
terminal
$ vagrant ssh

Git

terminal
$ sudo yum -y install git

rbenv

terminal
$ git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
$ source ~/.bash_profile

ruby-build

terminal
$ git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build

ruby

terminal
rbenv install 2.2.0

死んだ。。。

terminal
BUILD FAILED (CentOS Linux 7 using ruby-build 20150130-2-g8106d8f)

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

Last 10 log lines:
make[3]: ディレクトリ `/tmp/ruby-build.20150213200209.3634/ruby-2.2.0/ext/fiddle/libffi-3.2.1' から出ます
linking shared-object fiddle.so
/usr/bin/ld: ./libffi-3.2.1/.libs/libffi.a(raw_api.o): 再配置 R_X86_64_32S (`.rodata' に対する) は共有オブジェクト作成時には使用できません。-fPIC を付けて再コンパイルしてください。
./libffi-3.2.1/.libs/libffi.a: シンボルを読み込めませんでした: 不正な値です
collect2: エラー: ld はステータス 1 で終了しました
make[2]: *** [../../.ext/x86_64-linux/fiddle.so] エラー 1
make[2]: ディレクトリ `/tmp/ruby-build.20150213200209.3634/ruby-2.2.0/ext/fiddle' から出ます
make[1]: *** [ext/fiddle/all] エラー 2
make[1]: ディレクトリ `/tmp/ruby-build.20150213200209.3634/ruby-2.2.0' から出ます
make: *** [build-ext] エラー 2

こちらを参考にして

terminal
$ sudo yum install libffi-devel
terminal
$ rbenv install 2.2.0
terminal
Downloading ruby-2.2.0.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/7671e394abfb5d262fbcd3b27a71bf78737c7e9347fa21c39e58b0bb9c4840fc
Installing ruby-2.2.0...
Installed ruby-2.2.0 to /home/vagrant/.rbenv/versions/2.2.0

入ったぽい。

terminal
$ rbenv versions
terminal
2.2.0
terminal
$ rbenv global 2.2.0
$ ruby -v
terminal
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]

よし。

参考

rbenv を利用した ruby のインストール中にエラーとなる場合の対応 - Qiita
Ruby 2.2.0をrbenvとruby-buildでインストール - Qiita

10
9
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
10
9