2013-07-21 121 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