Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to install gem #84

Open
c0m3tx opened this issue Oct 4, 2016 · 8 comments
Open

Unable to install gem #84

c0m3tx opened this issue Oct 4, 2016 · 8 comments

Comments

@c0m3tx
Copy link

c0m3tx commented Oct 4, 2016

I'm trying to install ruby-debug-ide but it does not work:

~ gem install ruby-debug-ide -v 0.4.32
Building native extensions.  This could take a while...
ERROR:  Error installing ruby-debug-ide:
ERROR: Failed to build gem native extension.

current directory: /home/c0m3tx/.gem/ruby/2.3.0/gems/ruby-debug-ide-0.4.32/ext
/usr/bin/ruby mkrf_conf.rb
Installing base gem
You don't have write permissions for the /usr/lib/ruby/gems/2.3.0 directory.
/usr/lib/ruby/2.3.0/rubygems/installer.rb:685:in `verify_gem_home'
   /usr/lib/ruby/2.3.0/rubygems/installer.rb:805:in `pre_install_checks'
   /usr/lib/ruby/2.3.0/rubygems/installer.rb:272:in `install'
   /usr/lib/ruby/2.3.0/rubygems/request_set.rb:167:in `block in install'
   /usr/lib/ruby/2.3.0/rubygems/request_set.rb:151:in `each'
   /usr/lib/ruby/2.3.0/rubygems/request_set.rb:151:in `install'
   /usr/lib/ruby/2.3.0/rubygems/dependency_installer.rb:405:in `install'
   mkrf_conf.rb:35:in `rescue in <main>'
   mkrf_conf.rb:28:in `<main>'

I tried installing it as root but then I can't access the binary (which is located in /root/.gem/ruby/2.3.0/bin).
I tried putting the gem in my Gemfile but does not work (same error)

Why does it try to write in /usr/lib? Any way to bypass this behavior?
Thanks in advance

I'm on Ruby 2.3.0 on Archlinux, no RVM, no rbenv.

@denofevil
Copy link
Member

It is trying to install base gem that depends on ruby version that you're using. Since there's no builtin mechanism for that in rubygems, we're trying to install it manually. You can workaround this problem by running gem install debase --pre before installing ruby-debug-ide

@ZHOUYue67
Copy link

ZHOUYue67 commented Oct 18, 2016

@denofevil
I think the problem here is that this gem tried to install to /usr/lib/ruby/gems/2.3.0.
It should try to install toGem.user_dir if user-install option is set by gem command line or .gemrc configuration file.

When creating Gem::DependencyInstaller instances, it's better if you pass command line options as argument.

I might send a pull request for this when I have some time.

@c0m3tx
You can work around this by:
GEM_HOME=$(ruby -e "print Gem.user_dir") gem install ruby-debug-ide
or you can put this in your .profile or .bash_profile:
export GEM_HOME=$(ruby -e "print Gem.user_dir")

@ZHOUYue67
Copy link

Sorry about what I said above. It's wrong.

@c0m3tx you should just upgrade your gem to the latest version and everything will just work.

@athio92
Copy link

athio92 commented Apr 5, 2018

I had similar problem in Ubuntu 16.04, using Ruby version 2.3.1.
The problem was "Failed to build gem Native extension" , followed with exit message "rake failed, exit code 1".

I solved it by updating my Gem to latest version (2.7.6), then updated Rake from 10.5.0 to 12.3.1. After that, I tried installing ruby-debug-ide v0.6.1, and it works fine like magic.

@tripti-singh
Copy link

Updating the gems did the trick for me. Thanks.

@garrit-schroeder
Copy link

Saldy not for me. Need help

@garrit-schroeder
Copy link

Error running 'main': Failed to Install Gems. Following gems were not installed: /home/garrit/.IntelliJIdea2018.2/config/plugins/ruby/rb/gems/ruby-debug-ide-0.7.0.beta6.gem: Error installing ruby-debug-ide-0.7.0.beta6.gem: ERROR: Failed to build gem native extension. current directory: /home/garrit/.gem/ruby/2.5.0/gems/ruby-debug-ide-0.7.0.beta6/ext /usr/bin/ruby2.5 mkrf_conf.rb Installing base gem You don't have write permissions for the /var/lib/gems/2.5.0 directory. /usr/lib/ruby/2.5.0/rubygems/installer.rb:706:in verify_gem_home' /usr/lib/ruby/2.5.0/rubygems/installer.rb:837:in pre_install_checks' /usr/lib/ruby/2.5.0/rubygems/installer.rb:281:in install' /usr/lib/ruby/2.5.0/rubygems/resolver/specification.rb:97:in install' /usr/lib/ruby/2.5.0/rubygems/request_set.rb:168:in block in install' /usr/lib/ruby/2.5.0/rubygems/request_set.rb:156:in each' /usr/lib/ruby/2.5.0/rubygems/request_set.rb:156:in install' /usr/lib/ruby/2.5.0/rubygems/dependency_installer.rb:409:in install' mkrf_conf.rb:35:in rescue in ' mkrf_conf.rb:28:in ' rake failed, exit code 1 Gem files will remain installed in /home/garrit/.gem/ruby/2.5.0/gems/ruby-debug-ide-0.7.0.beta6 for inspection. Results logged to /home/garrit/.gem/ruby/2.5.0/extensions/x86_64-linux/2.5.0/ruby-debug-ide-0.7.0.beta6/gem_make.out

@ZHOUYue67
Copy link

@garrit-schroeder

  1. In your output I see You don't have write permissions for the /var/lib/gems/2.5.0 directory. Did you try to install the gem to system directory without sudo or you want to install the gem in your home directory?
  2. ERROR: Failed to build gem native extension. Maybe you have some missing dependencies for compiling the native extension. Follow the instructions to see detail log: /home/garrit/.gem/ruby/2.5.0/extensions/x86_64-linux/2.5.0/ruby-debug-ide-0.7.0.beta6/gem_make.out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants