Problems installing Ruby gem “ffi” on Ubuntu Server 12.04

南楼画角 提交于 2019-12-10 14:07:37

问题


I'm trying to use bundle to install gems required for my new project, but I'm having trouble installing version 1.1.5 of the 'ffi' gem.

I'm using Ruby 1.9.3 running on a virtualised install of 64-bit Ubuntu Server 12.04. When running the bundle command, I receive the following error message:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /home/alex/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for ffi.h... no
checking for ffi.h in /usr/local/include,/usr/include/ffi... no
checking for rb_thread_blocking_region()... yes
checking for ruby_native_thread_p()... yes
checking for rb_thread_call_with_gvl()... yes
creating extconf.h
creating Makefile

make
Configuring libffi
/gems/ffi-1.1.5/ext/ffi_c/libffi-x86_64-linux"SampleRails
/gems/ffi-1.1.5/ext/ffi_c/libffi-x86_64-linux'ems/ruby-1.9.3-p194@SampleRails
make "AR_FLAGS=" "CC_FOR_BUILD=" "CFLAGS=-Wall -fexceptions" "CXXFLAGS=" "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=" "LIBCFLAGS=" "LIBCFLAGS_FOR_TARGET=" "MAKE=make" "MAKEINFO=/b/gems/ffi-1.1.5/ext/ffi_c/libffi/missing --run makeinfo " "PICFLAG=" "PICFLAG_FOR_TARGET=" "RUNTESTFLAGS=" "SHELL=/bin/bash" "exec_prefix=/usr/local" "infodir=/usr/local/share/info" "libdir=/usr/local/lib" "mandir=/usr/local/share/man" "prefix=/usr/local" "AR=ar" "AS=as" "CC=gcc" "CXX=g++" "LD=/usr/bin/ld -m elf_x86_64" "NM=/usr/bin/nm -B" "RANLIB=ranlib" "DESTDIR=" all-recursive
/gems/ffi-1.1.5/ext/ffi_c/libffi-x86_64-linux'ems/ruby-1.9.3-p194@SampleRails
Making all in include
/gems/ffi-1.1.5/ext/ffi_c/libffi-x86_64-linux/include'-1.9.3-p194@SampleRails
make[3]: Nothing to be done for `all'.
/gems/ffi-1.1.5/ext/ffi_c/libffi-x86_64-linux/include'1.9.3-p194@SampleRails
Making all in testsuite
/gems/ffi-1.1.5/ext/ffi_c/libffi-x86_64-linux/testsuite'.9.3-p194@SampleRails
make[3]: Nothing to be done for `all'.
/gems/ffi-1.1.5/ext/ffi_c/libffi-x86_64-linux/testsuite'9.3-p194@SampleRails
Making all in man
/gems/ffi-1.1.5/ext/ffi_c/libffi-x86_64-linux/man'ruby-1.9.3-p194@SampleRails
make[3]: *** No rule to make target `ffi.3', needed by `all-am'. Stop.
/gems/ffi-1.1.5/ext/ffi_c/libffi-x86_64-linux/man'uby-1.9.3-p194@SampleRails
make[2]: *** [all-recursive] Error 1
/gems/ffi-1.1.5/ext/ffi_c/libffi-x86_64-linux'ms/ruby-1.9.3-p194@SampleRails
make[1]: *** [all] Error 2
/gems/ffi-1.1.5/ext/ffi_c/libffi-x86_64-linux'ms/ruby-1.9.3-p194@SampleRails
/gems/ffi-1.1.5/ext/ffi_c/libffi-x86_64-linux"/.libs/libffi_convenience.a] Error 2


/gems/ffi-1.1.5 for inspection. in /home/alex/.rvm/gems/ruby-1.9.3-p194@SampleRails
/gems/ffi-1.1.5/ext/ffi_c/gem_make.out/ruby-1.9.3-p194@SampleRails
An error occurred while installing ffi (1.1.5), and Bundler cannot continue.
Make sure that `gem install ffi -v '1.1.5'` succeeds before bundling.

The error seems to be caused by the line make[3]: *** No rule to make target 'ffi.3', needed by 'all-am' but I'm none the wiser as to what this means.

Can anybody help me out? Thanks in advance!


回答1:


Install the libffi-dev package:

sudo apt-get install libffi-dev

The ffi gem will build its internal libffi library if it cannot find the headers/link lib for libffi, which on a modern linux system is never what you want - just install your system's dev packages.



来源:https://stackoverflow.com/questions/12887816/problems-installing-ruby-gem-ffi-on-ubuntu-server-12-04

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!