ruby-build: 2.2.0 Build fails on Ubuntu 14.04.1 (x86_64)

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

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 39 (10 by maintainers)

Commits related to this issue

Most upvoted comments

Please install libffi-dev via apt-get or use ‘–enabled-shared’ option

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

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

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

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