Fixing debugger-linecache failure to install gem native extension with Ruby 1.9.3
Join the DZone community and get the full member experience.
Join For FreeThis can particularly happen if you’re using RVM or other ruby version managers
Now, most stackoverflow answers and blogs will tell you to issue the following command:
gem install debugger-ruby_core_source -v 1.2.3 --no-rdoc --no-ri -- --with-ruby-include=$rvm_path/src/ruby-1.9.3-p484 gem install debugger-linecache -v 1.1.2 --no-rdoc --no-ri -- --with-ruby-include=$rvm_path/src/ruby-1.9.3-p484
Note that some sites may even say “install debugger-ruby_core_source first!” but that doesn’t work. And you still get this message:
ERROR: Error installing debugger-linecache: ERROR: Failed to build gem native extension. /usr/local/rvm/rubies/ruby-1.9.3-p484/bin/ruby extconf.rb --with-ruby-include=/usr/local/rvm/rubies/ruby-1.9.3-p484 checking for vm_core.h... no checking for vm_core.h... no Makefile creation failed ************************************************************************** No source for ruby-1.9.3-p484 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=/usr/local/rvm/rubies/ruby-1.9.3-p484/bin/ruby --with-ruby-dir --without-ruby-dir --with-ruby-include=${ruby-dir}/include --with-ruby-lib --without-ruby-lib=${ruby-dir}/lib Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p484/gems/debugger-linecache-1.1.2 for inspection. Results logged to /usr/local/rvm/gems/ruby-1.9.3-p484/gems/debugger-linecache-1.1.2/ext/trace_nums/gem_make.out
So what’s going on? I’ll tell you.
Full-Proof Installation
First, let me tell you how you should be installing RVM and Ruby 1.9.3 in vagrant.
Step 1: Install RVM and Ruby
Here’s the command:
# install RVM and Ruby curl -L https://get.rvm.io | bash -s stable source /usr/local/rvm/scripts/rvm rvm use --install 1.9.3
Got it? Awesome.
Step 2: Fetch Ruby Source Code
Here comes the important part. INSTALL THE RUBY SOURCE CODE! This is the part NO ONE tells you. Here’s what you add right below that installation:
rvm fetch ruby-1.9.3-p484
Whoa, whoa, yep. That’s it. When your package tells you it can’t find vm_core, or that it can’t compile, this is probably the culprit. So make sure you fetch the source code.
Step 3: Install Debugger-Ruby-Core_Source first
If it wasn’t enough, we’ll install this nifty package first. This was the original fix on ruby’s github issue page. It works, some of the time, in some instances, sometimes. Let’s be sure we got it covered.
gem install debugger-ruby_core_source -v 1.2.3 --no-rdoc --no-ri -- --with-ruby-include=$rvm_path/src/ruby-1.9.3-p484
Ahh, what are all these damn options? More fallbacks:
- “-v 1.2.3″ specify correct debugger-ruby_core_source version that works with your debugger-linecache.
- “–no-rdoc –no-ri” don’t install documentation!
- “– –with-ruby-include=$rvm_path/src/ruby-1.9.3-p484″ this makes sure that everything gets compiled correctly. Remember how we fetched the ruby source? Here’s where it gets used!
Step 4: Install Debugger-linecache
Ahh, finally here. This step is basically almost the same as the one above:
gem install debugger-linecache -v 1.1.2 --no-rdoc --no-ri -- --with-ruby-include=$rvm_path/src/ruby-1.9.3-p484
Yay! And watch the success roll out.
Step 5: THANK ME WITH YOUR LIFE
Jk. But yeah, make sure to reference this article if you use it.
Published at DZone with permission of Antonin Januska. See the original article here.
Opinions expressed by DZone contributors are their own.
Trending
-
Implementing a Serverless DevOps Pipeline With AWS Lambda and CodePipeline
-
Hiding Data in Cassandra
-
Extending Java APIs: Add Missing Features Without the Hassle
-
Tactics and Strategies on Software Development: How To Reach Successful Software [Video]
Comments