安装ffi时出错

时间:2013-08-16 22:58:45

标签: ruby linux ffi

似乎可以解决这个问题。

$gem install ffi
Building native extensions.  This could take a while...
ERROR:  Error installing ffi:
ERROR: Failed to build gem native extension.

/remote/part/usern/.rvm/rubies/ruby-1.9.3-p448/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 rb_thread_call_with_gvl()... yes
checking for rb_thread_call_without_gvl()... yes
checking for ffi_prep_cif_var()... no
creating extconf.h
creating Makefile

make
libffi.gnu.mk:16: Extraneous text after `else' directive
libffi.gnu.mk:18: *** only one `else' per conditional.  Stop.


Gem files will remain installed in /remote/part/usern/.rvm/gems/ruby-1.9.3-p448@myrailsapp/gems/ffi-1.9.0 for inspection.
Results logged to /remote/part/usern/.rvm/gems/ruby-1.9.3-p448@myrailsapp/gems/ffi-1.9.0/ext/ffi_c/gem_make.out

有什么想法吗?

3 个答案:

答案 0 :(得分:1)

之前尝试这个
sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
apt-get install ruby{version}-dev

bundle install ffi

它对我有用

答案 1 :(得分:0)

我必须将gcc设置为4.2并且它有效。我还在Gemfile.lock中将ffi版本更改为1.0.9。

export PATH = / opt / gcc-4.2.0 / bin /:$ PATH

答案 2 :(得分:0)

嗨,这与GCC编译器相关,我更新了我的并且也做了Harpreet提到的技巧(ffi版本降级)但是没有必要ffi-1.9.3工作得很好:D

Gemfile.lock中的

    ffi (1.9.3)
    ffi (1.9.3-x86-mingw32)

https://github.com/kennethreitz/osx-gcc-installer

click here github repo with the .pkg installer for all OS (not only MacOSX)