Fix "An error occurred while installing debugger-linecache" with Ruby 1.9.3

Updated . Posted . Visible to the public.

You're better off using debugger-ruby_core_source:

gem install debugger-ruby_core_source

If you can't do this, try the following.


Here is how to fix the following error when installing the debugger gem fails:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension

Note: The following example is for a project using Ruby 1.9.3-p448 -- adjust accordingly for your project.

  1. Fetch the source for your Ruby version, if you do not yet have it:

    rvm fetch ruby-1.9.3-p448
    
  2. Install the gem by explicitly telling it where your Ruby's source is located:

    gem install debugger-linecache -v '1.1.2' -- --with-ruby-include=$rvm_path/src/ruby-1.9.3-p448
    
  3. Resume what you were doing before (probably a bundle install).


Here is how the "full" error looks like when a Bundler installation fails.

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /home/martin/.rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb 
checking for vm_core.h... no
checking for vm_core.h... no
Makefile creation failed
**************************************************************************
No source for ruby-1.9.3-p448 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=/home/martin/.rvm/rubies/ruby-1.9.3-p448/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 /home/martin/.rvm/gems/ruby-1.9.3-p448/gems/debugger-linecache-1.1.2 for inspection.
Results logged to /home/martin/.rvm/gems/ruby-1.9.3-p448/gems/debugger-linecache-1.1.2/ext/trace_nums/gem_make.out

An error occurred while installing debugger-linecache (1.1.2), and Bundler cannot continue.
Make sure that `gem install debugger-linecache -v '1.1.2'` succeeds before bundling.
Profile picture of Martin Straub
Martin Straub
Last edit
Arne Hartherz
License
Source code in this card is licensed under the MIT License.
Posted by Martin Straub to makandra dev (2013-10-15 09:22)