Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.2.0 Build fails on Ubuntu 14.04.1 (x86_64) #690

Closed
endgame opened this issue Dec 25, 2014 · 39 comments
Closed

2.2.0 Build fails on Ubuntu 14.04.1 (x86_64) #690

endgame opened this issue Dec 25, 2014 · 39 comments

Comments

@endgame
Copy link

endgame commented Dec 25, 2014

ruby-build version:

20141225-1-g45b75ed

The acutal error is:

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

I've included the full build log below, please let me know if you need me to test anything or I can give you better information:

/tmp/ruby-build.20141225215042.17047 /vagrant
Downloading ruby-2.2.0.tar.gz...
HTTP/1.1 200 OK
Content-Type: binary/octet-stream
Content-Length: 16494584
Connection: keep-alive
Date: Thu, 25 Dec 2014 11:08:01 GMT
Last-Modified: Thu, 25 Dec 2014 10:02:26 GMT
ETag: "cd03b28fd0b555970f5c4fd481700852"
Accept-Ranges: bytes
Server: AmazonS3
Age: 38568
X-Cache: Hit from cloudfront
Via: 1.1 f4bd0fa1d2fc98fb3b1433c4363b95c5.cloudfront.net (CloudFront)
X-Amz-Cf-Id: V02lmRmjOiRevHt69a4TLVEnXUV2CrbCthwribvZvRVeZGsN_NAf_Q==

-> http://dqw8nmjcqpjn7.cloudfront.net/7671e394abfb5d262fbcd3b27a71bf78737c7e9347fa21c39e58b0bb9c4840fc
/tmp/ruby-build.201412252config.guess already exists
config.sub already exists
checking build system type... x86_64-unknown-linux-gnu
(snip)
compiling conversions.c
make[3]: Entering directory `/tmp/ruby-build.20141225215042.17047/ruby-2.2.0/ext/fiddle/libffi-3.2.1'
make 'AR_FLAGS=' 'CC_FOR_BUILD=' 'CFLAGS=-O3 -fno-fast-math -ggdb3  -Wall -fexceptions' 'CXXFLAGS=-O3 -fno-fast-math -ggdb3 ' 'CFLAGS_FOR_BUILD=' 'CFLAGS_FOR_TARGET=' 'INSTALL=/usr/bin/install -c' 'INSTALL_DATA=/usr/bin/install -c -m 644' 'INSTALL_PROGRAM=/usr/bin/install -c' 'INSTALL_SCRIPT=/usr/bin/install -c' 'JC1FLAGS=' 'LDFLAGS=-L. -L/home/vagrant/.rbenv/versions/2.2.0/lib  -fstack-protector -rdynamic -Wl,-export-dynamic  -L../../.. ' 'LIBCFLAGS=' 'LIBCFLAGS_FOR_TARGET=' 'MAKE=make' 'MAKEINFO=/bin/bash /tmp/ruby-build.20141225215042.17047/ruby-2.2.0/ext/fiddle/libffi-3.2.1/missing makeinfo ' 'PICFLAG=' 'PICFLAG_FOR_TARGET=' 'RUNTESTFLAGS=' 'SHELL=/bin/bash' 'exec_prefix=/usr/local' 'infodir=/usr/local/share/info' 'libdir=/home/vagrant/.rbenv/versions/2.2.0/lib' 'mandir=/usr/local/share/man' 'prefix=/usr/local' 'AR=ar' 'AS=as' 'CC=gcc' 'CXX=g++' 'LD=ld -m elf_x86_64' 'NM=/usr/bin/nm -B' 'RANLIB=ranlib' 'DESTDIR=' all-recursive
make[4]: Entering directory `/tmp/ruby-build.20141225215042.17047/ruby-2.2.0/ext/fiddle/libffi-3.2.1'
Making all in include
make[5]: Entering directory `/tmp/ruby-build.20141225215042.17047/ruby-2.2.0/ext/fiddle/libffi-3.2.1/include'
make[5]: Nothing to be done for `all'.
make[5]: Leaving directory `/tmp/ruby-build.20141225215042.17047/ruby-2.2.0/ext/fiddle/libffi-3.2.1/include'
Making all in testsuite
make[5]: Entering directory `/tmp/ruby-build.20141225215042.17047/ruby-2.2.0/ext/fiddle/libffi-3.2.1/testsuite'
make[5]: Nothing to be done for `all'.
make[5]: Leaving directory `/tmp/ruby-build.20141225215042.17047/ruby-2.2.0/ext/fiddle/libffi-3.2.1/testsuite'
Making all in man
make[5]: Entering directory `/tmp/ruby-build.20141225215042.17047/ruby-2.2.0/ext/fiddle/libffi-3.2.1/man'
make[5]: Nothing to be done for `all'.
make[5]: Leaving directory `/tmp/ruby-build.20141225215042.17047/ruby-2.2.0/ext/fiddle/libffi-3.2.1/man'
make[5]: Entering directory `/tmp/ruby-build.20141225215042.17047/ruby-2.2.0/ext/fiddle/libffi-3.2.1'
  CC       src/prep_cif.lo
  CC       src/types.lo
  CC       src/raw_api.lo
  CC       src/java_raw_api.lo
  CC       src/closures.lo
src/closures.c: In function 'dlmmap_locked':
src/closures.c:488:17: warning: ignoring return value of 'ftruncate', declared with attribute warn_unused_result [-Wunused-result]
       ftruncate (execfd, offset);
                 ^
src/closures.c:500:17: warning: ignoring return value of 'ftruncate', declared with attribute warn_unused_result [-Wunused-result]
       ftruncate (execfd, offset);
                 ^
  CC       src/x86/ffi64.lo
  CPPAS    src/x86/unix64.lo
  CC       src/x86/ffi.lo
  CPPAS    src/x86/sysv.lo
  CCLD     libffi_convenience.la
  CCLD     libffi.la
make[5]: Leaving directory `/tmp/ruby-build.20141225215042.17047/ruby-2.2.0/ext/fiddle/libffi-3.2.1'
make[4]: Leaving directory `/tmp/ruby-build.20141225215042.17047/ruby-2.2.0/ext/fiddle/libffi-3.2.1'
make[3]: Leaving directory `/tmp/ruby-build.20141225215042.17047/ruby-2.2.0/ext/fiddle/libffi-3.2.1'
linking shared-object fiddle.so

BUILD FAILED (Ubuntu 14.04 using ruby-build 20141225-1-g45b75ed)

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

Last 10 log lines:
make[3]: Leaving directory `/tmp/ruby-build.20141225215042.17047/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): 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.20141225215042.17047/ruby-2.2.0/ext/fiddle'
make[1]: *** [ext/fiddle/all] Error 2
make[1]: Leaving directory `/tmp/ruby-build.20141225215042.17047/ruby-2.2.0'
make: *** [build-ext] Error 2
@hsbt
Copy link
Member

hsbt commented Dec 25, 2014

Please install libffi-dev via apt-get or use '--enabled-shared' option

@endgame
Copy link
Author

endgame commented Dec 26, 2014

Thank you, this fixes it for me.

@jlecour
Copy link

jlecour commented Dec 29, 2014

Same issue with Debian 7 ; libffi-dev was missing.

@hsbt
Copy link
Member

hsbt commented Dec 30, 2014

@mislav
Copy link
Member

mislav commented Dec 31, 2014

@hsbt Can you add these packages to "suggested build environment" on the top? That would help people who paste these instructions prior to installing Ruby versions on their respective systems.

@hsbt
Copy link
Member

hsbt commented Jan 1, 2015

@mislav done! Thanks for your advice.

@ainslied
Copy link

ainslied commented Jan 2, 2015

Hi, I'm using Debian jessie.
I cannot find this package :

sudo apt-get install libffi-dev
E: Package 'libffi-dev' has no installation candidate

sudo apt-get update; apt-cache search libffi
libffi6 - Bibliothèque d'exécution de l'interface de fonction étrangère (FFI)

with Debian Wheezy (in an other server), I get more, do you know why? My source.list seems well configured..
sudo apt-get update; apt-cache search libffi
ffindex-dbg - simple index/database for huge amounts of small files (debug)
libffindex0 - library for simple index/database for huge amounts of small files
libffindex0-dev - library for simple index/database for huge amounts of small files (development)
libjffi-java - Java Foreign Function Interface
libjffi-jni - Java Foreign Function Interface (JNI library)
lib32ffi-dev - Foreign Function Interface library (development files, 32bit)
libffi-dev - Foreign Function Interface library (development files)
libffi5-dbg - Foreign Function Interface library runtime (debug symbols)
libffi-ruby - Transitional package for ruby-ffi
libffi-ruby1.8 - Transitional package for ruby-ffi
libffi-ruby1.9.1 - Transitional package for ruby-ffi
ruby-ffi - load dynamic libraries, bind functions from within ruby code
libffi5 - Bibliothèque d'exécution de l'interface de fonction étrangère (FFI)
libbfio-dbg - Library to provide basic input/output abstraction (debug)

@ainslied
Copy link

ainslied commented Jan 2, 2015

Sorry, my /etc/apt/preferences was not empty

@zachad
Copy link

zachad commented Jan 5, 2015

Same goes for CentOS 6.x where you'll need to yum install libffi-devel

@GCorbel
Copy link

GCorbel commented Jan 10, 2015

sudo apt-get install libffi-dev workd for me on Linux Mint 17.1. Thanks!

@ryanburnette
Copy link

I'm having this exact issue on Ubuntu 14.04.1 LTS but I have libffi-dev installed. Posted as a question on Stack Oveflow in case anyone has any insight.

@raulgobr
Copy link

same here with 14.04.1 LTS. I have the libffi-dev.

@gnodiah
Copy link

gnodiah commented Jan 22, 2015

sovled after installed libffi-dev, thanks

@kirylrb
Copy link

kirylrb commented Jan 22, 2015

Have same issue on Ubuntu 15.04 Alpha

$ RUBY_CONFIGURE_OPTS=--enable-shared rbenv install 2.2.0
Downloading ruby-2.2.0.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/7671e394abfb5d262fbcd3b27a71bf78737c7e9347fa21c39e58b0bb9c4840fc
Installing ruby-2.2.0...

BUILD FAILED (Ubuntu 15.04 using ruby-build 20150116-6-g7f1d8df)

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

Last 10 log lines:
    from /tmp/ruby-build.20150122215659.9399/ruby-2.2.0/lib/rubygems.rb:556:in `install'
    from ./tool/rbinstall.rb:717:in `block (2 levels) in <main>'
    from ./tool/rbinstall.rb:716:in `each'
    from ./tool/rbinstall.rb:716:in `block in <main>'
    from ./tool/rbinstall.rb:749:in `call'
    from ./tool/rbinstall.rb:749:in `block in <main>'
    from ./tool/rbinstall.rb:746:in `each'
    from ./tool/rbinstall.rb:746:in `<main>'
uncommon.mk:244: recipe for target 'do-install-all' failed
make: *** [do-install-all] Error 1

@davidcpell
Copy link

I am on 14.04.1 LTS and successfully installed 2.2 with rbenv install 2.2.0 after first running sudo apt-get install libffi-dev

@ryanburnette
Copy link

A guy on my SO issue said that he fixed it by setting CFLAG to CFLAG=-fPIC.

@ghost
Copy link

ghost commented Jan 23, 2015

I also had the same issue with 14.04. LTS. Solved after installing libffi-dev.

@hsbt
Copy link
Member

hsbt commented Jan 23, 2015

@ryanburnette We(ruby-core) added -fPIC option for next release of Ruby 2.2 🙇

@ajahongir
Copy link

👍

@ryanburnette
Copy link

👏

bikezilla added a commit to bikezilla/chef-ruby_build that referenced this issue Feb 16, 2015
@njia
Copy link

njia commented Feb 18, 2015

I had same problem, install libffi did not work but after I installed gcc using linuxbrew the ruby 2.2.0 installed successfully but installing gcc took 70 minutes on my VM.

@naskoblg
Copy link

I have same issue with Ruby 2.2.1 on FreeBSD 9.3-STABLE amd64

I was able to fix it using:

- /etc/make.conf
CC=clang
CXX=clang++
CPP=clang-cpp
CFLAG=-fPIC
- export
$ CFLAG=-fPIC
$ export CFLAG
$ RUBY_CONFIGURE_OPTS=--enable-shared
$ export RUBY_CONFIGURE_OPTS

Then build:

$ 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/dev/.rbenv/versions/2.2.1

@hsbt
Copy link
Member

hsbt commented Mar 20, 2015

@naskoblg We already fixed FreeBSD issue with upstream. see https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/49957

@aried3r
Copy link

aried3r commented Mar 20, 2015

@hsbt, so from what I've gathered, I do not have to manually install libffi-dev anymore with 2.2.1, right? Because I tried with 2.2.1 and still get the following when not installing libffi-dev

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.20150319171236.15537/ruby-2.2.1/ext/fiddle'
make[1]: *** [ext/fiddle/all] Error 2

The error message suggests, as @naskoblg already verified, that adding -fPIC to the compiler flags works. I'll see how I can do that, since I'm using rbenv via chef on Ubuntu Server 14.04 LTS

@manuelmeurer
Copy link
Contributor

Installing libffi-dev fixed this for me. (Ruby 2.2.1, Ubuntu 14.04)

@hsbt hsbt reopened this Mar 20, 2015
@kulbida
Copy link

kulbida commented Mar 21, 2015

Installing libffi-dev didn't help to install ruby 2.2.1 on my Debian 7. However installing with --enabled-shared option activated helped. Thanks.

@rilian
Copy link

rilian commented Mar 25, 2015

thanks, sudo apt-get install libffi-dev helped on Ubuntu 14.04.1 LTS to rbenv install 2.2.1 😍

@FabFab
Copy link

FabFab commented Apr 3, 2015

on Amazon Linux 2014.09, same as @zachad for Centos, of course.

yum install libffi-devel

leucos added a commit to erasme/ansible-ruby-compiled that referenced this issue Apr 7, 2015
Added libffi-dev as ruby dependency, so we avoid problems when building
2.2.x.
Ref: rbenv/ruby-build#690
@hsbt
Copy link
Member

hsbt commented Apr 19, 2015

Hi all. Please try to Ruby 2.2.2

@hsbt hsbt closed this as completed Apr 19, 2015
@aried3r
Copy link

aried3r commented Apr 25, 2015

Hi all. Please try to Ruby 2.2.2

Works for me, thanks!

@hsbt
Copy link
Member

hsbt commented Apr 25, 2015

@aried3r 👍 Thanks for your feedback

@lifehome
Copy link

After installing the libffi-devel-3.0.13-11.el7.x86_64 on Centos 7, it still fails to install Ruby 2.2.2...
Any idea?

UPDATE: installed after sudo -ing all the installation thing, but this is not good for long-term solution, right?

@wtgee
Copy link

wtgee commented Aug 17, 2015

Having this issue with all 2.x. libffi-dev is installed.

$ RUBY_CONFIGURE_OPTS=--enable-shared
$ rbenv install 2.2.2
Downloading ruby-2.2.2.tar.gz...
-> https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.2.tar.gz
error: failed to download ruby-2.2.2.tar.gz

BUILD FAILED (LinuxMint 17.2 using ruby-build 20150803)

@wtgee
Copy link

wtgee commented Aug 17, 2015

After fiddling around a whole bunch, I found some errors in the logs related to certificates. This answer by Scott Emmons here (not the "correct" solution on that page but the second one down) fixed my problem.

@lakesare
Copy link

Thank you, helped for Ubuntu 15.10 with Ruby 2.2.1.

cben added a commit to cben/guides that referenced this issue Feb 14, 2016
A couple "Configure PostgreSQL" commands didn't work as-is; clarified where password is asked.

rbenv install 2.2.0 gives an obscure warning fixed by having libffi-devel [rbenv/ruby-build#690].
Their FAQ actually suggests more [https://github.com/rbenv/ruby-build/wiki#suggested-build-environment]:
    dnf install -y gcc bzip2 openssl-devel libyaml-devel libffi-devel readline-devel zlib-devel gdbm-devel ncurses-devel
but `bzip2 libffi-devel readline-devel` 3 were enough to build.

nodejs is the obvious option to satisfy ExecJS, otherwise sprockets/es6 gem refuses to load.
@Markmwaura
Copy link

installing sudo apt-get install libffi-dev worked for me on ubuntu 14.04.1. Thanks!

@nathanjo
Copy link

For AWS, after running yum install libffi-devel still issue occured, and need to execute yum install gcc and its fixed the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests