2011-12-02 143 views
0

我正在设置黄瓜为rails。我将它包含在我的Gemfile中并运行了bundle安装。安装黄瓜时发生错误(涉及小黄瓜)

gem 'cucumber-rails' 
    gem 'database_cleaner' 

我得到了这个错误。我该怎么办?

ERROR: Error installing gherkin: 
    ERROR: Failed to build gem native extension. 

     /Users/[my_user_name]/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb 
checking for main() in -lc... *** 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. 
+0

安装什么是你的环境像(OS和这样的?)?你有一个可用的C编译器吗? –

+0

OS X Lion,我有gcc。 – jyli7

回答

3

这个问题有点旧,但是因为我的机器上只有类似的问题,所以我会在这里记录我的解决方案。

该问题似乎与OS X Lion,GCC,clang等有关(请参阅https://github.com/carlhuda/bundler/issues/1590https://github.com/carlhuda/bundler/issues/1600)。至于如何编译ruby似乎是我决定重新安装(也是升级)ruby的问题。

以下是解决这个问题对我来说:

复杂,但我现在可以natiive扩展安装宝石。

希望这会有所帮助。

更新: btw。可以继续使用ruby-1.9.2-p290,所有你需要做的就是重新安装它。

  • 第一 “卸载” 老红宝石1.9.2-P290:rm -rf .rbenv/versions/1.9.2-p290
  • 然后拆掉require_gcc线1.9.2-P290
  • 最后用env CC=/usr/bin/gcc rbenv install 1.9.2-p290