7433


rbenv で Ruby 2.2.1 のインストールを試みましたが失敗しました。  
Ubuntu 14.04 と ruby-build 20150303 を使っています。

[code]

    $ 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 14.04 using ruby-build 20150303)
    
    Inspect or clean up the working tree at /tmp/ruby-build.20150304173607.22408
    Results logged to /tmp/ruby-build.20150304173607.22408.log
    
    Last 10 log lines:
    compiling ossl_digest.c
    compiling ossl_x509req.c
    compiling ossl_asn1.c
    installing default openssl libraries
    linking shared-object psych.so
    make[2]: Leaving directory `/tmp/ruby-build.20150304173607.22408/ruby-2.2.1/ext/psych'
    linking shared-object openssl.so
    make[2]: Leaving directory `/tmp/ruby-build.20150304173607.22408/ruby-2.2.1/ext/openssl'
    make[1]: Leaving directory `/tmp/ruby-build.20150304173607.22408/ruby-2.2.1'
    make: *** [build-ext] Error 2
    
[/code]


CC BY-SA 3.0
2015-03-04T09:01:52.927
7432
2015-03-04T09:01:52.927
724
question
ruby rbenv
rbenv での Ruby 2.2.1 のインストールに失敗する

[code]

    Results logged to /tmp/ruby-build.20150304173607.22408.log
    
[/code]

とあるのでまず `/tmp/ruby-build.20150304173607.22408.log` を見てみると、以下のようなログが残っていました。

[code]

    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: error adding symbols: Bad value
    collect2: error: ld returned 1 exit status
    make[2]: *** [../../.ext/x86_64-linux/fiddle.so] Error 1
    make[2]: Leaving directory `/tmp/ruby-build.20150304174118.5523/ruby-2.2.1/ext/fiddle'
    make[1]: *** [ext/fiddle/all] Error 2
    make[1]: *** Waiting for unfinished jobs....
    
[/code]

ruby-build の wiki にもありますが、`libffi-dev` パッケージをインストールすることで解決します。

[code]

    $ sudo apt-get install libffi-dev
    
[/code]

<https://github.com/sstephenson/ruby-build/wiki#build-failure-of-fiddle-with-
ruby-220>


CC BY-SA 3.0
2015-03-04T09:01:52.927
7433
2015-03-04T09:01:52.927
724
7432
answer