安装黄瓜时出错(涉及小黄瓜)
我正在尝试为 Rails 设置黄瓜。我将其包含在 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.
I'm trying to set up cucumber for rails. I included this in my Gemfile and ran bundle install.
gem 'cucumber-rails'
gem 'database_cleaner'
I got this error. What should I do?
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这个问题有点老了,但由于我的机器上刚刚遇到了类似的问题,我将在这里记录我的解决方案。
该问题似乎与 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/成功安装1.9.3-p125 bin/gcc rbenv install 1.9.3-p125
很复杂,但我现在可以安装带有本机扩展的 gems。
希望这有帮助。
更新:顺便说一句。可以继续使用 ruby-1.9.2-p290,您所要做的就是重新安装它。
rm -rf .rbenv/versions/1.9.2-p290
require_gcc
行-p290This question is a bit old, but as I just had a similar problem on my machine I will document my solution here.
The problem seems to be related to OS X Lion, GCC, clang etc. (see https://github.com/carlhuda/bundler/issues/1590 and https://github.com/carlhuda/bundler/issues/1600). As how ruby was compiled seems to be the problem I decided to re-install (and also upgrade) ruby.
Here is what solved this issue for me:
rbenv install 1.9.3-p125
failed (see https://github.com/sstephenson/ruby-build/issues/129 and https://github.com/sstephenson/ruby-build/issues/130)require_gcc
line for 1.9.3-p125 (if installed with homebrew you find the file under/usr/local/Cellar/ruby-build/20120216/share/ruby-build/1.9.3-p125
)env CC=/usr/bin/gcc rbenv install 1.9.3-p125
Complicated but I can now install gems with natiive extensions.
Hope this helps.
Update: btw. It is possible to keep using ruby-1.9.2-p290, all you have to do is re-install it.
rm -rf .rbenv/versions/1.9.2-p290
require_gcc
line for 1.9.2-p290env CC=/usr/bin/gcc rbenv install 1.9.2-p290