我尝试使用bundle
来安装新项目所需的宝石,但我在安装' ffi'的版本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'
引起的,但我并不清楚这意味着什么。
有人可以帮帮我吗?提前谢谢!
答案 0 :(得分:13)
安装libffi-dev软件包:
sudo apt-get install libffi-dev
如果找不到libffi的头文件/链接库,ffi gem将构建其内部libffi库,这在现代Linux系统上从不你想要的东西 - 只需安装系统的开发包。