我正在尝试为导轨设置黄瓜。我把它包含在我的Gemfile中并运行bundle install。
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 :(得分:3)
这个问题有点陈旧,但由于我的机器上遇到了类似的问题,我将在此处记录我的解决方案。
问题似乎与OS X Lion,GCC,clang等有关(请参阅https://github.com/carlhuda/bundler/issues/1590和https://github.com/carlhuda/bundler/issues/1600)。由于编译ruby似乎是问题所以我决定重新安装(并且还升级)ruby。
以下是我解决这个问题的原因:
rbenv install 1.9.3-p125
失败(请参阅https://github.com/sstephenson/ruby-build/issues/129和https://github.com/sstephenson/ruby-build/issues/130)require_gcc
行(如果与自制软件一起安装,则在/usr/local/Cellar/ruby-build/20120216/share/ruby-build/1.9.3-p125
下找到该文件)env CC=/usr/bin/gcc rbenv install 1.9.3-p125
复杂但我现在可以安装具有延伸扩展名的宝石。
希望这有帮助。
更新: btw。可以继续使用ruby-1.9.2-p290,您只需重新安装即可。
rm -rf .rbenv/versions/1.9.2-p290
require_gcc
行
env CC=/usr/bin/gcc rbenv install 1.9.2-p290