ERROR: Error installing ffi: ERROR: Failed to buil

2019-01-25 05:52发布

Got the DevKit installed and re-ran the ffi install….got this as an output:

C:\Documents and Settings\******>gem install ffi
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing ffi:
        ERROR: Failed to build gem native extension.

        C:/Ruby192/bin/ruby.exe extconf.rb
checking for ffi.h... no
checking for ffi.h in /usr/local/include... no
checking for rb_thread_blocking_region()... yes
checking for ruby_thread_has_gvl_p()... yes
checking for ruby_native_thread_p()... yes
checking for rb_thread_call_with_gvl()... yes
creating extconf.h
creating Makefile
make
C:/Ruby192/bin/ruby -e "puts 'EXPORTS', 'Init_ffi_c'"  > ffi_c-i386-mingw32.def
gcc -I. -IC:/Ruby192/include/ruby-1.9.1/i386-mingw32 -I/C/Ruby192/include/ruby-1
.9.1/ruby/backward -I/C/Ruby192/include/ruby-1.9.1 -I. -DRUBY_EXTCONF_H=\"extcon
f.h\"    -O3 -g -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -
Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -Wno-declaration-a
fter-statement   -o AbstractMemory.o -c AbstractMemory.c
In file included from AbstractMemory.c:28:0:
compat.h:65:20: warning: extra tokens at end of #ifndef directive
compat.h:69:24: warning: extra tokens at end of #ifndef directive
In file included from AbstractMemory.h:29:0,
                 from AbstractMemory.c:29:
Types.h:68:17: fatal error: ffi.h: No such file or directory
compilation terminated.
make: *** [AbstractMemory.o] Error 1 

Gem files will remain installed in C:/Ruby192/lib/ruby/gems/1.9.1/gems/ffi-1.0.1
0 for inspection.
Results logged to C:/Ruby192/lib/ruby/gems/1.9.1/gems/ffi-1.0.10/ext/ffi_c/gem_m
ake.out
_________________________________________________________________________________

Not sure how to deal with this issue. Kindly help.

标签: ruby gem ffi
12条回答
ゆ 、 Hurt°
2楼-- · 2019-01-25 06:12

you need this,

apt-get install ruby2.2-dev
查看更多
贪生不怕死
3楼-- · 2019-01-25 06:13

I got the same problem. In my case, I have not install the DevKit, which can be found: http://rubyinstaller.org/downloads/. After installing DevKit, just follow the instruction https://github.com/oneclick/rubyinstaller/wiki/development-kit and finally it's up and running.

查看更多
祖国的老花朵
4楼-- · 2019-01-25 06:14

For me the fix was running in this order. I'm not sure what all was relevant, but it worked:

gem install ffi --version '1.0.9'

The above failed, but then I could successfully run:

gem install bundler

...and subsequently:

gem install ffi

...which got the latest version (1.6.0 at the time of writing this) and installed it successfully.

查看更多
一夜七次
5楼-- · 2019-01-25 06:18

Installing the 'osx-gcc-installer' worked for me: (osx 10.8)

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

查看更多
戒情不戒烟
6楼-- · 2019-01-25 06:18

Put DevKit in front of your PATH, and install again from Windows command prompt.

查看更多
Lonely孤独者°
7楼-- · 2019-01-25 06:19
sudo apt-get install libffi-dev

This worked for me

查看更多
登录 后发表回答