20

I am having a problem with installing linecache19(dependency of ruby-debug19) for ruby 1.9.2

Here is my term output

$ rvm use 1.9.2
Using /home/bogdan/.rvm/gems/ruby-1.9.2-p180
$ ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux]
$ rvm exec gem install linecache19 --backtrace
gem install linecache19 --backtrace

rvm 1.6.20 by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]

ERROR:  Error installing linecache19:
    linecache19 requires Ruby version >= 1.9.2.
ERROR:  Error installing linecache19:
    linecache19 requires Ruby version >= 1.9.2.
Building native extensions.  This could take a while...

The last command hangs forever until interrupted with ^C.

Any ideas how to fix that?

Bogdan Gusiev
  • 8,027
  • 16
  • 61
  • 81

8 Answers8

48

You may be having the same problem as I was. When I ran bundle install I got the error:

Installing linecache19 (0.5.12) with native extensions
/Users/joseph/.rvm/rubies/ruby-1.9.2p290/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:552:in `rescue in block in build_extensions':
ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

/Users/joseph/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb 

From http://isitruby19.com/linecache19 I found that this worked:

gem install ruby-debug19 -- --with-ruby-include=$rvm_path/src/ruby-1.9.2-p290
JosephL
  • 5,952
  • 1
  • 28
  • 25
  • 1
    I had a similar issue and tried the commands but it didn't help without a forceful installation of linecache19, so all who face with similar errors check my working solution at http://stackoverflow.com/questions/7700828/installing-gems-without-rvm-as-root-with-explicit-version-of-ruby/7781550#7781550 – Reza Hashemi Oct 16 '11 at 00:20
  • 1
    BTW I am now using https://github.com/cldwalker/debugger. It is "A fork of ruby-debug(19) that works on 1.9.2 and 1.9.3 and installs easily for rvm/rbenv rubies." – JosephL May 10 '12 at 02:00
  • Same problem on 1.9.3-head + mac os x 10.7 lion, just use $rvm_path/src/ruby-1.9.3-head will do the job. – William Yeung Jun 20 '12 at 04:46
  • I had a similar error with debugger-linecache and your --with-ruby-include solved it, for me. – Otto Oct 23 '12 at 16:13
2

I had the same issue (linecache19 hangs forever/indefinitely) when using rbenv on OS X Lion. I found the solution was to install Ruby with OpenSSL option, like this:

rbenv install 1.9.2-p290 --with-openssl-dir=/usr/local
reben rehash
rbenv global 1.9.2-p290

Now, you can run this and it'll install fine:

gem install ruby-debug19

Hope that helps someone. Hat tip to adrpac's gist.

Mike
  • 9,692
  • 6
  • 44
  • 61
1

rvm exec attempts to run the given command over every version of Ruby installed. Do you have another version installed other than 1.9.2 (including the system default)? If so, it's likely this version that's failing.

If you rvm use 1.9.2, you don't need to do anything special to have commands execute in the context of Ruby 1.9.2--RVM sets up the environment when you run use. Just do a gem install linecache19 --backtrace.

Michelle Tilley
  • 157,729
  • 40
  • 374
  • 311
1

You can even do something along the lines of

rvm 1.9.2@global exec 'gem install linecache19 -- --with-ruby-include="${rvm_path}/src/${rvm_env_string//@*}"'

You can then do something like this to apply the install against all your 1.9.2 rubies.

for ver in $(ls $rvm_path/rubies | grep 1.9.2 | sed s/ruby-//g | sed s/\\///g); do rvm $ver@global exec 'gem install linecache19 -- --with-ruby-include="${rvm_path}/src/${rvm_env_string//@*}"'

That command will walk through each 1.9.2 ruby returned from the $(ls ..) command and apply your rvm command to each of them.

ddd
  • 1,925
  • 12
  • 19
1

This worked for me

rvm @global gem install ruby-debug19 -- --with-ruby-include=$rvm_path/src/$(rvm tools strings)
chrismealy
  • 4,830
  • 2
  • 23
  • 24
0

Specifying the source of the ruby files under rvm worked for me

gem install linecache19  -- --with-ruby-include=$rvm_path/src/ruby-1.9.2-head/
Skillachie
  • 3,176
  • 1
  • 25
  • 26
0

Try to comment

 #gem 'ruby-debug19', :require => 'ruby-debug'

Then bundle install.

JP.
  • 1,035
  • 2
  • 17
  • 39
0

What worked for me was running gem under rvm, using exec:

'sudo rvm exec gem install ruby-debug19'
'sudo rvm exec gem install linecache19'
Peter Oram
  • 6,213
  • 2
  • 27
  • 40
sudo
  • 1