ruby-debug on Ruby 1.9 Gem::Installer::ExtensionBuildError

I’m starting to use Ruby 1.9.2 with ChiliProject now but I kept running into an error during bundle install:

Installing linecache (0.43) with native extensions /home/edavis/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:529:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

        /home/edavis/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb
Can't handle 1.9.x yet
*** 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/edavis/.rvm/rubies/ruby-1.9.2-p180/bin/ruby

The key message buried in that error is: Can’t handle 1.9.x yet.

Solution

After some google-fu I found that you need to use a different ruby-debug gem on 1.9 (which will pull in the 1.9 version of linecache).

# Gemfile
gem 'awesome_print'
 
group :test do
  gem 'redgreen'
  # Pulls in linecache19 which is 1.9 compatable
  gem 'ruby-debug19', :require => 'ruby-debug', :platforms => :mri_19
  # Pulls in linecache which is 1.8 only
  gem 'ruby-debug', :platforms => :mri_18
end

Hope this helps someone

One comment

Comments are closed.