安装调试器时出错:无法使用ruby-1.9.3-p362构建gem本机扩展

时间:2012-12-27 19:56:31

标签: ruby-on-rails ruby bundle

在为新项目尝试运行包时,我遇到以下错误:

Installing debugger (1.2.2) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    C:/Ruby193/bin/ruby.exe extconf.rb
checking for rb_method_entry_t.called_id in method.h... no
checking for rb_control_frame_t.method_id in method.h... no
checking for rb_method_entry_t.called_id in method.h... no
checking for rb_control_frame_t.method_id in method.h... no
Makefile creation failed
**************************************************************************
No source for ruby-1.9.3-p362 provided with debugger-ruby_core_source gem.
**************************************************************************
*** 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=C:/Ruby193/bin/ruby
        --with-ruby-dir
        --without-ruby-dir
        --with-ruby-include
        --without-ruby-include=${ruby-dir}/include
        --with-ruby-lib
        --without-ruby-lib=${ruby-dir}/lib


Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/debugger-1.2.2 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/debugger-1.2.2/ext/ruby_debug/gem_make.out
An error occured while installing debugger (1.2.2), and Bundler cannot continue.
Make sure that `gem install debugger -v '1.2.2'` succeeds before bundling.

运行gem install debugger -v '1.2.2'会产生相同的结果。

我已经检查了mkmf.log和gem_make.out文件的内容,但它们没什么意义,但是如果要求我会发布它们。

为什么这不起作用?

8 个答案:

答案 0 :(得分:41)

我遇到了同样的问题。我试过了:

bundle update debugger

我的Gemfile有这个:

gem 'debugger'

它有效,我没有必要更改Gemfile。 bundle的输出显示类似这样的东西

...

Installing debugger-ruby_core_source (1.1.6)

Installing debugger-linecache (1.1.2) with native extensions

Installing debugger (1.1.4) with native extensions

...

答案 1 :(得分:16)

解决问题的方法是简单地安装debugger-ruby_core_source gem - forked version of debugger-ruby_core_source by eiel on github

经过多次试验和错误(就我而言),我只是

gem install debugger-ruby_core_source -v '1.1.6'

强制包含p362标头。然后,当我运行bundle时,使用本机扩展成功构建了调试器,并且捆绑器继续使用它的快乐方式,我就是这样。

只是一个注意事项,虽然我已经多次使用 ,但我尝试了几件事并花了几个小时让这个工作才真正实现简单溶液

答案 2 :(得分:10)

也许最好使用捆绑更新,在这里工作得很好。

  

$ bundle update debugger-ruby_core_source

考虑对所有调试器gems使用更新:

  

$ bundle update debugger

答案 3 :(得分:6)

ruby​​ 2中不支持显式调试器。*因此请使用byebug。 http://edgeguides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-byebug-gem

答案 4 :(得分:6)

尝试了一段时间后,我终于放弃了,并将debugger替换为byebug

与pry一起使用:

gem 'pry', group: [:development, :test]
gem 'pry-byebug', group: [:development, :test]

然后,您可以在任何想要启动调试器的位置删除binding.pry语句。

答案 5 :(得分:4)

刚刚通过RVM安装了Ruby 2.0.0。其他解决方案都不适合我。

如果二进制文件可用,RVM将只安装二进制文件,速度更快,但调试器也需要源代码

rvm reinstall 2.0.0 --disable-binary

答案 6 :(得分:1)

如果你要使用rvm,请确保你有正确的子版本来匹配debase-ruby_core_source ordebugger-ruby_core_source。

即。 在debase-ruby_core_source中,ruby 2.0.0仅支持p195,p247,p353,p451,p481,p576。 以上不支持!

如果您的ruby版本与提供的源不匹配。你无法通过它。 (导致"无法找到源错误!")

------------debase-ruby_core_source 0.6.0 vm_Core support list ----------------
../usr/local/rvm/rubies/ruby-2.0.0-p598/lib/ruby/gems/2.0.0/gems/debase-ruby_core_source-0.6.0/lib/debase/ruby_core_source/ruby-2.0.0-p0/vm_core.h
./usr/local/rvm/rubies/ruby-2.0.0-p598/lib/ruby/gems/2.0.0/gems/debase-ruby_core_source-0.6.0/lib/debase/ruby_core_source/ruby-2.0.0-p195/vm_core.h
./usr/local/rvm/rubies/ruby-2.0.0-p598/lib/ruby/gems/2.0.0/gems/debase-ruby_core_source-0.6.0/lib/debase/ruby_core_source/ruby-2.0.0-p247/vm_core.h
./usr/local/rvm/rubies/ruby-2.0.0-p598/lib/ruby/gems/2.0.0/gems/debase-ruby_core_source-0.6.0/lib/debase/ruby_core_source/ruby-2.0.0-p353/vm_core.h
./usr/local/rvm/rubies/ruby-2.0.0-p598/lib/ruby/gems/2.0.0/gems/debase-ruby_core_source-0.6.0/lib/debase/ruby_core_source/ruby-2.0.0-p451/vm_core.h
./usr/local/rvm/rubies/ruby-2.0.0-p598/lib/ruby/gems/2.0.0/gems/debase-ruby_core_source-0.6.0/lib/debase/ruby_core_source/ruby-2.0.0-p481/vm_core.h
./usr/local/rvm/rubies/ruby-2.0.0-p598/lib/ruby/gems/2.0.0/gems/debase-ruby_core_source-0.6.0/lib/debase/ruby_core_source/ruby-2.0.0-p576/vm_core.h
./usr/local/rvm/rubies/ruby-2.0.0-p598/lib/ruby/gems/2.0.0/gems/debase-ruby_core_source-0.6.0/lib/debase/ruby_core_source/ruby-2.1.0-p0/vm_core.h
./usr/local/rvm/rubies/ruby-2.0.0-p598/lib/ruby/gems/2.0.0/gems/debase-ruby_core_source-0.6.0/lib/debase/ruby_core_source/ruby-2.1.1-p76/vm_core.h
./usr/local/rvm/rubies/ruby-2.0.0-p598/lib/ruby/gems/2.0.0/gems/debase-ruby_core_source-0.6.0/lib/debase/ruby_core_source/ruby-2.1.2-p95/vm_core.h
./usr/local/rvm/rubies/ruby-2.0.0-p598/lib/ruby/gems/2.0.0/gems/debase-ruby_core_source-0.6.0/lib/debase/ruby_core_source/ruby-2.1.3-p242/vm_core.h
./usr/local/rvm/rubies/ruby-2.0.0-p598/lib/ruby/gems/2.0.0/gems/debase-ruby_core_source-0.6.0/lib/debase/ruby_core_source/ruby-2.2.0-preview1/vm_core.h

答案 7 :(得分:0)

对我有用:

$ rvm use 2.0

或将其设为默认值:

$ rvm use --default 2.0