2013-07-21 162 views
1

我想設置ruby項目的環境。 但是當我運行 '捆綁',我安裝 'FII' 寶石中有錯誤:無法設置紅寶石環境 - 安裝fii寶石錯誤

 

    Installing ffi (1.8.1) 
    Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. 

     /Users/bmalets/.rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb 
    checking for ffi.h... *** extconf.rb failed *** 
    Could not create Makefile due to some reason, probably lack of 
    necessary libraries and/or headers. Check the mkmf.log file for more 
    details. You may need configuration options. 

    /Users/bmalets/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError) 
    You have to install development tools first. 

    Gem files will remain installed in /Users/bmalets/.rvm/gems/[email protected]/gems/ffi-1.8.1 for inspection. 
    Results logged to /Users/bmalets/.rvm/gems/[email protected]/gems/ffi-1.8.1/ext/ffi_c/gem_make.out 

    An error occurred while installing ffi (1.8.1), and Bundler cannot continue. 
    Make sure that `gem install ffi -v '1.8.1'` succeeds before bundling. 

 

我的環境:

  • OS_X 10.8.4

  • 紅寶石1.9.3p448

  • Xcode 4.6.3

  • libffi-3.0.13

請幫我解決它。

回答

4

確保您已經安裝了蘋果的Xcode和命令行工具(看看這個截圖):

https://developer.apple.com/technologies/tools/

之後,不要忘記安裝libffi。

1)如果你使用自制

brew install libffi 

2)如果你正在使用macport

sudo port install libffi 
+0

這是一個非常常見的錯誤。我使用macports,它們比brew更靈活,如果你來自unix背景,就像魅力一樣工作。如果沒有,最好使用brew。 –

+0

我已經安裝了'libffi'和Xcode。不幸的是,我不明白問題的原因是什麼((。 – bmalets

+0

@bmalets可能是這些步驟將幫助:http://stackoverflow.com/a/10610951/595120 – gvalmon