簡體   English   中英

gem install ffi -v'1.1.5'osx 10.8

[英]gem install ffi -v '1.1.5' osx 10.8

我一直試圖在OSX 10.8上安裝ffi

gem install ffi -v '1.1.5'

結果

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

我試過跟隨

安裝ffi(1.1.2)時發生錯誤,Bundler無法繼續

山獅升級后無法安裝一些寶石

沒有運氣。

我的ffi安裝失敗,出現了類似的錯誤消息:

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

我在命令中發現xcrun cc並嘗試手動運行它給了我Apple的消息,我沒有同意XCode命令行工具的許可協議。 在sudo xcrun cc之后安裝成功了。

$ 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'
...

```

看起來ffi堅持在你的系統運行64位時構建32位版本。

很可能有兩種方法可以繼續:

  1. 嘗試使用最新版本的gem gem install ffi - 但這不必工作 - 因為這需要在庫中修復,
  2. 編譯32位ruby rvm install 1.9.3-n32 --32 - rvm install 1.9.3-n32 --32 - 但這也不必工作,因為大多數庫很可能會編譯為64位,因此它可能無法編譯或編譯並出現問題

嘗試安裝Xcode Command Line Toolshttps://github.com/kennethreitz/osx-gcc-installer

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM