简体   繁体   中英

Error installing debugger: Failed to build gem native extension with ruby-1.9.3-p362

While trying run bundle for a new project, I'm encountering the following error:

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.

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.

Why doesn't this work?

I ran into same issue. I tried:

bundle update debugger

My Gemfile had this:

gem 'debugger'

And it worked, I did not have to change Gemfile. Output of bundle shows something like this

...

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

...

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 .

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.

Just a note, while I've used simply several times, I tried several things and spent several hours to get this to work before I actually came to the simple solution.

Maybe it better use the bundle update, worked fine here.

$ bundle update debugger-ruby_core_source

Consider to use update to all debugger gems:

$ bundle update debugger

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

After trying for a while, I finally gave up and replaced debugger with byebug .

To use with pry:

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

You can then drop a binding.pry statement anywhere you want to start the debugger.

Just ran into this with Ruby 2.0.0 installed via RVM. None of the other solutions worked for me.

RVM will just install with the binaries if they are available, which is faster, but debugger needs the source too

rvm reinstall 2.0.0 --disable-binary

if you would use rvm, make sure you have the right sub version to match debase-ruby_core_source ordebugger-ruby_core_source.

ie in debase-ruby_core_source for ruby 2.0.0 only support p195 ,p247, p353,p451,p481,p576. above is not supported!

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!")

------------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

that worked for me:

$ rvm use 2.0

or to make it default:

$ rvm use --default 2.0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM