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

31,145

Solution 1

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

...

Solution 2

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.

Solution 3

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

Solution 4

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.

Solution 5

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

Share:
31,145
erroric
Author by

erroric

I'm just a (mostly) hairless monkey making my way through the world and occasionally coding for a living.

Updated on April 21, 2020

Comments

  • erroric
    erroric about 4 years

    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?

    • Lucio
      Lucio over 9 years
      If ruby -v gives you 2.x, consider using byebug instead (as stated in official documentation only 1.9.2 and 1.9.3 are supported).
    • Otheus
      Otheus over 6 years
      @Lucio, byebug "requires version 2.2.x" and above. Apparently, ruby 2.0 users are left out in the complete cold for a useful debugger (which pry is definitely not).
  • erroric
    erroric over 11 years
    I'll give this a try next time I encounter a similar error. It looks like I took the long way around to get there... ;)
  • Ziyan Junaideen
    Ziyan Junaideen over 10 years
    What the !@#$%^... How did it work ? ;) Is it kind of using a new version of the gem?
  • chadoh
    chadoh about 10 years
    Bravo! gem install debugger-ruby_core_source allowed me to continue on my bundleing way. :-)
  • Gank
    Gank about 10 years
    Why I get apple$ bundle update debugger Could not find gem 'debugger'. error?
  • Mahendra Liya
    Mahendra Liya over 9 years
    I had to execute gem install debugger-ruby_core_source
  • Mohamed Salah
    Mohamed Salah over 9 years
    thank you man ... as you say "None of the other solutions worked for me"