[英]Error while installing ruby on rails,Failed to build gem native extension
[英]Error installing debugger: Failed to build gem native extension with ruby-1.9.3-p362
在尝试为新项目运行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文件的内容,但它们没什么意义,但是如果要求我会发布它们。
为什么这不起作用?
我遇到了同样的问题。 我试过了:
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
...
该问题的解决方案是简单地安装debugger-ruby_core_source gem - 由github上的eiel组成的debugger-ruby_core_source的分叉版本 。
经过多次试验和错误(就我而言),我只是
gem install debugger-ruby_core_source -v '1.1.6'
这强制包含p362标头。 然后,当我运行bundle
,使用本机扩展成功构建了调试器,并且Bundler继续使用它的快乐方式,因此我也是。
刚一说明,而我只是用了几次,我试了好东西,花了几个小时得到这个之前,我确实来到了简单的解决方案工作。
也许它更好地使用捆绑更新,在这里工作得很好。
$ bundle update debugger-ruby_core_source
考虑对所有调试器gems使用更新:
$ bundle update debugger
ruby 2中不支持显式调试器。*因此请使用byebug。 http://edgeguides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-byebug-gem
经过一段时间的努力,我终于放弃了并用byebug
取代了debugger
。
与pry一起使用:
gem 'pry', group: [:development, :test]
gem 'pry-byebug', group: [:development, :test]
然后,您可以在任何要启动调试器的位置删除binding.pry
语句。
刚刚通过RVM安装了Ruby 2.0.0。 其他解决方案都不适合我。
如果二进制文件可用,RVM将只安装二进制文件,速度更快,但调试器也需要源代码
rvm reinstall 2.0.0 --disable-binary
如果你要使用rvm,请确保你有正确的子版本来匹配debase-ruby_core_source ordebugger-ruby_core_source。
即在rubase 2.0.0的debase-ruby_core_source中仅支持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
这对我有用:
$ rvm use 2.0
或者将其设为默认值:
$ rvm use --default 2.0
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.