Gem install ffi -v '1.1.5' osx 10.8

I tried to install ffi on OSX 10.8 via

gem install ffi -v '1.1.5' 

with the result

 ERROR: Error installing ffi: ERROR: Failed to build gem native extension. /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/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()... no checking for ruby_native_thread_p()... no checking for rb_thread_call_with_gvl()... no creating extconf.h creating Makefile make mkdir -p "/Library/Ruby/Gems/1.8/gems/ffi-1.1.5/ext/ffi_c"/libffi-i386; (if [ ! -f "/Library/Ruby/Gems/1.8/gems/ffi-1.1.5/ext/ffi_c"/libffi-i386/Makefile ]; then echo "Configuring libffi for i386"; cd "/Library/Ruby/Gems/1.8/gems/ffi-1.1.5/ext/ffi_c"/libffi-i386 && env CC=" xcrun cc" CFLAGS="-arch i386 " LDFLAGS="-arch i386" "/Library/Ruby/Gems/1.8/gems/ffi-1.1.5/ext/ffi_c/libffi"/configure --disable-static --with-pic=yes --disable-dependency-tracking --host=i386-apple-darwin > /dev/null; fi); env MACOSX_DEPLOYMENT_TARGET=10.4 make -C "/Library/Ruby/Gems/1.8/gems/ffi-1.1.5/ext/ffi_c"/libffi-i386 Configuring libffi for i386 configure: WARNING: if you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used configure: error: in `/Library/Ruby/Gems/1.8/gems/ffi-1.1.5/ext/ffi_c/libffi-i386': configure: error: C compiler cannot create executables See `config.log' for more details make[1]: *** No targets specified and no makefile found. Stop. make: *** ["/Library/Ruby/Gems/1.8/gems/ffi-1.1.5/ext/ffi_c"/libffi- i386/.libs/libffi_convenience.a] Error 2 Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/ffi-1.1.5 for inspection. Results logged to /Library/Ruby/Gems/1.8/gems/ffi-1.1.5/ext/ffi_c/gem_make.out 

I tried to follow

An error occurred while installing ffi (1.1.2) and the Bundler cannot continue

and

Failed to set some stones after mountain lion upgrade

no luck.

+5
gem macos
source share
3 answers

My ffi installation failed with a pretty similar error message:

 mkdir -p "/Library/Ruby/Gems/1.8/gems/ffi-1.9.0/ext/ffi_c"/libffi-i386; (if [ ! -f "/Library/Ruby/Gems/1.8/gems/ffi-1.9.0/ext/ffi_c"/libffi-i386/Makefile ]; then echo "Configuring libffi for i386"; cd "/Library/Ruby/Gems/1.8/gems/ffi-1.9.0/ext/ffi_c"/libffi-i386 && env CC=" xcrun cc" CFLAGS="-arch i386 " LDFLAGS="-arch i386" "/Library/Ruby/Gems/1.8/gems/ffi-1.9.0/ext/ffi_c/libffi"/configure --disable-static --with-pic=yes --disable-dependency-tracking --host=i386-apple-darwin > /dev/null; fi); env MACOSX_DEPLOYMENT_TARGET=10.4 make -C "/Library/Ruby/Gems/1.8/gems/ffi-1.9.0/ext/ffi_c"/libffi-i386 Configuring libffi for i386 configure: WARNING: if you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used configure: error: in `/Library/Ruby/Gems/1.8/gems/ffi-1.9.0/ext/ffi_c/libffi-i386': configure: error: C compiler cannot create executables 

I noticed xcrun cc in the command and tried to start it manually, gave me an Apple message that I did not agree with the Xcode command line license agreement. After sudo xcrun cc, the installation was successful.

 $ xcrun cc Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo. $ sudo xcrun cc You have not agreed to the Xcode license agreements. You must agree to both license agreements below in order to use Xcode. Hit the Enter key to view the license agreements at '/Applications/Xcode.app/Contents/Resources/English.lproj/License.rtf' ... 

`` ``

+2
source share

It looks like ffi is pushing for a 32-bit version, while your system is running on a 64-bit version.

There are most likely two ways to continue:

  • try using the latest gem gem install ffi version - but this will not work - since it needs to be fixed in the library,
  • compile 32-bit ruby ​​rvm rvm install 1.9.3-n32 --32 - but this should not work either, since most libraries will most likely be compiled for 64-bit, so it cannot compile or compile and present problems.
0
source share

Try installing Xcode Command Line Tools or https://github.com/kennethreitz/osx-gcc-installer

0
source share

All Articles