rbenvでruby2.2.1をインストールしようとすると失敗する
% rbenv install 2.2.1 Downloading ruby-2.2.1.tar.gz... -> http://dqw8nmjcqpjn7.cloudfront.net/5a4de38068eca8919cb087d338c0c2e3d72c9382c804fb27ab746e6c7819ab28 Installing ruby-2.2.1... BUILD FAILED (Ubuntu 12.04 using ruby-build 20150319zf) Inspect or clean up the working tree at /tmp/ruby-build.20150401104154.14557 Results logged to /tmp/ruby-build.20150401104154.14557.log Last 10 log lines: make[3]: Leaving directory `/tmp/ruby-build.20150401104154.14557/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_32S against `.rodata' 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 returned 1 exit status make[2]: *** [../../.ext/x86_64-linux/fiddle.so] Error 1 make[2]: Leaving directory `/tmp/ruby-build.20150401104154.14557/ruby-2.2.1/ext/fiddle' make[1]: *** [ext/fiddle/all] Error 2 make[1]: Leaving directory `/tmp/ruby-build.20150401104154.14557/ruby-2.2.1' make: *** [build-ext] Error 2 146.97s user 24.35s system 77% cpu 3:41.61 total
libffiあたりでこけてるのが分かる。could not read symbolsってあたりで、dev用のパッケージが足りないんだなと当たりをつけて、libffi-devのパッケージを入れる。
sudo aptitude install libffi-dev
再度インストール。今度はうまくいく。
% 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 /home/masashi/.anyenv/envs/rbenv/versions/2.2.1 315.78s user 33.74s system 81% cpu 7:09.01 total