【发布时间】:2016-05-24 12:57:25
【问题描述】:
我正在尝试下载 rails 并查看了我能找到的所有解决方案。我已经重新下载了 Xcode(7.0 beta)并单独安装了命令行工具,包括运行: xcode-选择--安装 这似乎适用于大多数有同样问题的人。我想我可能已经损坏了 C 头文件。
checking if the C compiler accepts ... *** extconf.rb failed ***
非常感谢任何帮助!
完整的错误代码:
XXX-MacBook-Pro-2:~ XXX$ gem install rails
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/Users/XXX/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20150923-10275-18xpyzg.rb extconf.rb
checking if the C compiler accepts ... *** 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.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/XXX/.rvm/rubies/ruby-2.2.1/bin/$(RUBY_BASE_NAME)
--help
--clean
/Users/XXX/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/XXX/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/mkmf.rb:571:in `block in try_compile'
from /Users/XXX/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/mkmf.rb:522:in `with_werror'
from /Users/XXX/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/mkmf.rb:571:in `try_compile'
from extconf.rb:80:in `nokogiri_try_compile'
from extconf.rb:87:in `block in add_cflags'
from /Users/XXX/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/mkmf.rb:619:in `with_cflags'
from extconf.rb:86:in `add_cflags'
from extconf.rb:337:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/XXX/.rvm/gems/ruby-2.2.1/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /Users/XXX/.rvm/gems/ruby-2.2.1/extensions/x86_64-darwin-14/2.2.0-static/nokogiri-1.6.6.2/gem_make.out
【问题讨论】:
-
Homebrew 或其他 OS X 包管理器之一消除了在 Mac 上安装开源软件的大部分痛苦。
-
可以添加
mkmf.log的内容吗?你也在运行homebrew吗?如果是这样,brew list | grep libxml2的输出是什么? -
是
nokogiri失败了吗?那颗宝石有special problems on OS X。 -
“查看 mkmf.log 文件了解更多详情。”
标签: c ruby macos ruby-on-rails-4