0

我正在尝试在 OS X 10.9 上运行“捆绑更新”,但失败并显示以下错误消息:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /Users/FrancisO/.rvm/rubies/ruby-1.9.3-p392/bin/ruby extconf.rb 
checking for ruby/util.h... *** 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
    --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/FrancisO/.rvm/rubies/ruby-1.9.3-p392/bin/ruby
/Users/FrancisO/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /Users/FrancisO/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
    from /Users/FrancisO/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:931:in `block in have_header'
    from /Users/FrancisO/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
    from /Users/FrancisO/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
    from /Users/FrancisO/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /Users/FrancisO/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
    from /Users/FrancisO/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /Users/FrancisO/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
    from /Users/FrancisO/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
    from /Users/FrancisO/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:930:in `have_header'
    from extconf.rb:14:in `<main>'


Gem files will remain installed in /Users/FrancisO/.rvm/gems/ruby-1.9.3-p392/gems/bcrypt-ruby-3.1.0 for inspection.
Results logged to /Users/FrancisO/.rvm/gems/ruby-1.9.3-p392/gems/bcrypt-ruby-3.1.0/ext/mri/gem_make.out

An error occurred while installing bcrypt-ruby (3.1.0), and Bundler cannot continue.
Make sure that `gem install bcrypt-ruby -v '3.1.0'` succeeds before bundling.

Xcode 5 (Preview 3) 已经安装,命令行工具也已安装。以下是一些相关信息:

gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.1.61) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix

brew update
Already up-to-date.

rvm requirements
Installing requirements for osx, might require sudo password.
Certificates in '/usr/local/etc/openssl/cert.pem' already are up to date.
Requirements installation successful.

到目前为止,我在安装任何版本的 Ruby 时都没有任何问题(使用 rvm)。有人有什么主意吗?

谢谢,弗朗西斯

4

3 回答 3

5

确保您的默认 ruby​​ 是 1.9.3-p448。rvm --default use 1.9.3-p448

于 2013-07-27T17:50:01.730 回答
3

对我来说,通过安装 xcode 命令行工具解决了这个问题。在终端运行中:

xcode-select --install

然后在弹出窗口中选择安装。

我最近安装了 xcode 5,我想我需要在安装后运行上述命令,但我没有,并且不知何故导致bundle update失败。

于 2013-12-17T23:18:12.803 回答
0

我有同样的问题,问题是升级到 OSX 10.9 (mavericks) 时我没有确认我同意 Xcode 的许可协议。如果您键入以下内容

gcc --version

你应该得到“你没有同意 Xcode 许可协议”。

一旦同意一切正常

于 2013-11-05T16:57:51.273 回答