我正在尝试为rails设置cucumber。我将其包含在我的Gemfile中,并运行包安装。
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.发布于 2012-03-21 22:58:15
这个问题有点老了,但是因为我的机器上刚刚遇到了类似的问题,所以我将在这里记录我的解决方案。
这个问题似乎与OS X Lion,GCC,clang等有关(参见https://github.com/carlhuda/bundler/issues/1590和https://github.com/carlhuda/bundler/issues/1600)。由于ruby是如何编译的,这似乎是我决定重新安装(并升级) ruby的问题。
以下是为我解决这个问题的方法:
对于当前版本的rbenv和ruby-
rbenv install 1.9.3-p125安装的),我使用Xcode的命令行工具构建失败(请参阅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很复杂,但是我现在可以安装带有本地扩展的gem了。
希望这能有所帮助。
更新: btw。可以继续使用ruby-1.9.2-p290,您所要做的就是重新安装它。
ruby安装首先“卸载”旧的ruby-1.9.2-p290:rm -rf .rbenv/versions/1.9.2-p290
env CC=/usr/bin/gcc rbenv install 1.9.2-p290
的require_gcc行
https://stackoverflow.com/questions/8360325
复制相似问题