5

我正在尝试使用bundle安装新项目所需的 gem,但在安装 'ffi' gem 的 1.1.5 版时遇到问题。

我正在使用在 64 位 Ubuntu Server 12.04 的虚拟安装上运行的 Ruby 1.9.3。运行bundle命令时,我收到以下错误消息:

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.

该错误似乎是由该行引起的,make[3]: *** No rule to make target 'ffi.3', needed by 'all-am'但我不知道这意味着什么。

有人可以帮帮我吗?提前致谢!

4

1 回答 1

13

安装 libffi-dev 包:

sudo apt-get install libffi-dev

如果 ffi gem 找不到 libffi 的标头/链接库,它将构建其内部 libffi 库,这在现代 linux 系统上永远不是您想要的 - 只需安装系统的开发包。

于 2012-10-15T03:09:53.480 回答