Installing linecache19 for Ruby 1.9.2 via rvm

 ̄綄美尐妖づ 提交于 2019-11-28 05:55:50

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

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.

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.

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.

This worked for me

rvm @global gem install ruby-debug19 -- --with-ruby-include=$rvm_path/src/$(rvm tools strings)

Try to comment

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

Then bundle install.

sudo

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

'sudo rvm exec gem install ruby-debug19'
'sudo rvm exec gem install linecache19'

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/
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!