无法构建gem原生扩展

时间:2013-06-27 18:29:19

标签: ruby gem bundler

我不太清楚为什么,但我似乎无法安装任何涉及构建原生扩展的gem。任何人都可以建议如何开始调试此问题?这是我用gem install debugger

得到的输出
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /Users/Chintan/.rvm/rubies/ruby-1.9.3-p0/bin/ruby extconf.rb
checking for rb_method_entry_t.called_id in method.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
    --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/Chintan/.rvm/rubies/ruby-1.9.3-p0/bin/ruby
    --with-ruby-dir
    --without-ruby-dir
    --with-ruby-include=${ruby-dir}/include
    --with-ruby-lib
    --without-ruby-lib=${ruby-dir}/lib
/Users/Chintan/.rvm/rubies/ruby-1.9.3-p0/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/Chintan/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:491:in `block in try_compile'
    from /Users/Chintan/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:443:in `with_werror'
    from /Users/Chintan/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:491:in `try_compile'
    from /Users/Chintan/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:1002:in `block in have_struct_member'
    from /Users/Chintan/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
    from /Users/Chintan/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
    from /Users/Chintan/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /Users/Chintan/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
    from /Users/Chintan/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /Users/Chintan/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
    from /Users/Chintan/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
    from /Users/Chintan/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:1001:in `have_struct_member'
    from extconf.rb:34:in `block in <main>'
    from /Users/Chintan/.rvm/gems/ruby-1.9.3-p0/gems/debugger-ruby_core_source-1.2.3/lib/debugger/ruby_core_source.rb:21:in `call'
    from /Users/Chintan/.rvm/gems/ruby-1.9.3-p0/gems/debugger-ruby_core_source-1.2.3/lib/debugger/ruby_core_source.rb:21:in `create_makefile_with_core'
    from extconf.rb:87:in `<main>'


Gem files will remain installed in /Users/Chintan/.rvm/gems/ruby-1.9.3-p0/gems/debugger-1.6.0 for inspection.
Results logged to /Users/Chintan/.rvm/gems/ruby-1.9.3-p0/gems/debugger-1.6.0/ext/ruby_debug/gem_make.out
An error occurred while installing debugger (1.6.0), and Bundler cannot continue.

另外,我最近重新安装了自制软件,这可能是问题所在?我肯定安装了XCode Developre Tools。

这是mkmf.log的内容:

○ cat /Users/Chintan/.rvm/gems/ruby-1.9.3-p0/gems/debugger-1.6.0/ext/ruby_debug/mkmf.log
"/usr/local/bin/gcc-4.2 -o conftest -I/Users/Chintan/.rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/x86_64-darwin12.2.1 -I/Users/Chintan/.rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/ruby/backward -I/Users/Chintan/.rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1 -I. -I/Users/Chintan/.rvm/src/ruby-1.9.3-p0 -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE    -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -I/Users/Chintan/.rvm/usr/include -fno-common -pipe conftest.c  -L. -L/Users/Chintan/.rvm/rubies/ruby-1.9.3-p0/lib -L. -L/Users/Chintan/.rvm/usr/lib     -lruby.1.9.1  -lpthread -ldl -lobjc "
/Users/Chintan/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/mkmf.rb:317: warning: Insecure world writable dir /usr/local/heroku/bin in PATH, mode 040777
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main() {return 0;}
/* end */

1 个答案:

答案 0 :(得分:0)

这对我有用:

gem update debugger-ruby_core_source