安装调试器时出错:无法使用 ruby-1.9.3-p362 构建 gem 本机扩展
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14060513/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error installing debugger: Failed to build gem native extension with ruby-1.9.3-p362
提问by erroric
While trying run bundle for a new project, I'm encountering the following error:
在尝试为新项目运行 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.
Running gem install debugger -v '1.2.2'produces the same results.
运行gem install debugger -v '1.2.2'产生相同的结果。
I've checked the contents of the mkmf.log and gem_make.out file and they make little sense, but if requested I will post them.
我已经检查了 mkmf.log 和 gem_make.out 文件的内容,它们没什么意义,但如果需要,我会发布它们。
Why doesn't this work?
为什么这不起作用?
回答by user1783021
I ran into same issue. I tried:
我遇到了同样的问题。我试过:
bundle update debugger
bundle update debugger
My Gemfile had this:
我的 Gemfile 有这个:
gem 'debugger'
gem 'debugger'
And it worked, I did not have to change Gemfile. Output of bundle shows something like this
它奏效了,我不必更改 Gemfile。包的输出显示如下
...
...
Installing debugger-ruby_core_source (1.1.6)
Installing debugger-ruby_core_source (1.1.6)
Installing debugger-linecache (1.1.2) with native extensions
Installing debugger-linecache (1.1.2) with native extensions
Installing debugger (1.1.4) with native extensions
Installing debugger (1.1.4) with native extensions
...
...
回答by erroric
The solution to the problem was to simply to install the debugger-ruby_core_source gem - a forked version of debugger-ruby_core_source by eiel on github.
该问题的解决方案是简单地安装 debugger-ruby_core_source gem - github 上 eiel 的 debugger-ruby_core_source的分叉版本。
After much trial and error (on my part), I simply
经过多次反复试验(就我而言),我只是
gem install debugger-ruby_core_source -v '1.1.6'
which force the inclusion of the p362 headers. Then when I ran bundle, debugger was successfully built with the native extensions, and bundler continued on it's merry way and so was I.
这会强制包含 p362 标头。然后当我运行时bundle,调试器成功地构建了本机扩展,并且 bundler 继续它的快乐方式,我也是。
Just a note, while I've used simplyseveral times, I tried several things and spent several hours to get this to work before I actually came to the simplesolution.
请注意,虽然我已经简单地使用了几次,但在我真正找到简单的解决方案之前,我尝试了几件事并花了几个小时来让它发挥作用。
回答by Rafael Sachetto
Maybe it better use the bundle update, worked fine here.
也许最好使用捆绑更新,在这里工作正常。
$ bundle update debugger-ruby_core_source
$ bundle update debugger-ruby_core_source
Consider to use update to all debugger gems:
考虑对所有调试器 gem 使用更新:
$ bundle update debugger
$ 捆绑更新调试器
回答by fenec
Apparently debugger is not supported in ruby 2.* so use byebug instead. http://edgeguides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-byebug-gem
显然 ruby 2.* 不支持调试器,因此请改用 byebug。 http://edgeguides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-byebug-gem
回答by cevaris
After trying for a while, I finally gave up and replaced debuggerwith byebug.
尝试了一段时间后,我终于放弃了,取而代之的debugger是byebug.
To use with pry:
与撬一起使用:
gem 'pry', group: [:development, :test]
gem 'pry-byebug', group: [:development, :test]
You can then drop a binding.prystatement anywhere you want to start the debugger.
然后,您可以binding.pry在要启动调试器的任何位置放置一条语句。
回答by chris finne
Just ran into this with Ruby 2.0.0 installed via RVM. None of the other solutions worked for me.
刚刚通过 RVM 安装了 Ruby 2.0.0 时遇到了这个问题。其他解决方案都不适合我。
RVM will just install with the binaries if they are available, which is faster, but debugger needs the source too
如果二进制文件可用,RVM 将只安装它们,这会更快,但调试器也需要源代码
rvm reinstall 2.0.0 --disable-binary
回答by TC Juan
if you would use rvm, make sure you have the right sub version to match debase-ruby_core_source ordebugger-ruby_core_source.
如果您要使用 rvm,请确保您有正确的子版本来匹配 debase-ruby_core_source 或 debugger-ruby_core_source。
i.e. in debase-ruby_core_source for ruby 2.0.0 only support p195 ,p247, p353,p451,p481,p576. above is not supported!
即在 ruby 2.0.0 的 debase-ruby_core_source 中仅支持 p195、p247、p353、p451、p481、p576。以上不支持!
if your ruby version is not match the source provided. you won't be able to make it through. (that cause "Can not find the source error!")
如果您的 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
回答by zombie_ghast
that worked for me:
这对我有用:
$ rvm use 2.0
or to make it default:
或使其默认:
$ rvm use --default 2.0

