using gems installed via 'sudo gem install'


P

Piotr S.

I've installed ruby-opengl through sudo gem install because there were
errors otherwise and now I can't use it with 'ruby main.rb'. When I
typed 'sudo ruby main.rb' I think it worked but there were errors
considering hashes as they're changed in latest version of ruby (I think
I have different ruby versions as I'm also using RVM).
I know it's confusing but is there a way to somehow transfer gem from
root to rvm or maybe a way to access roots gems without sudo triggering
wrong version of ruby?


gem install ruby-opengl fails saying that it can't find rake executable
for rake-0.8.7. I can install rake via 'gem install' but it doesn't
really work because I can install it multiple times without it
complaining about rake being already installed.
 
Ad

Advertisements

P

Phillip Gawlowski

I've installed ruby-opengl through sudo gem install because there were
errors otherwise and now I can't use it with 'ruby main.rb'. When I
typed 'sudo ruby main.rb' I think it worked but there were errors
considering hashes as they're changed in latest version of ruby (I think
I have different ruby versions as I'm also using RVM).

Well, if you didn't do a "sudo rvm gem install" (or whatever the
syntax is RVM uses to install gems), then your installed gem lands in
the system-wide gem repository, which isn't accessible if you switch
Ruby versions via rvm.
I know it's confusing but is there a way to somehow transfer gem from
root to rvm or maybe a way to access roots gems without sudo triggering
wrong version of ruby?

Create a gemset:
http://rvm.beginrescueend.com/gemsets/

That seems to be the easiest way (unless you can install gems via RVM
itself; pik can do that for us Windows users, so I doubt RVM can't do
that).

RVM's documentation should also reveal a means to sync gems across
different Ruby versions managed by RVM.

--
Phillip Gawlowski

Though the folk I have met,
(Ah, how soon!) they forget
When I've moved on to some other place,
There may be one or two,
When I've played and passed through,
Who'll remember my song or my face.
 
P

Piotr S.

I have gemset created but I don't know how is that helping because there
is no rvm command (that I aware of) to import gem to gemset other that
'rvm gem install' and this isn't working (same error).
Also I can't use 'sudo rvm gem install' because it says 'rvm: command
not found' even though I have rvm in my 'sudo gem list'
 
H

Hassan Schroeder

I've installed ruby-opengl through sudo gem install because there were
errors otherwise and now I can't use it with 'ruby main.rb'. When I
typed 'sudo ruby main.rb' I think it worked but there were errors
considering hashes as they're changed in latest version of ruby (I think
I have different ruby versions as I'm also using RVM).
I know it's confusing

No it's not.

"I think I have different ruby versions as I'm also using RVM" -- WTF?
You "think"??? If you can say that, you may have RVM installed, but
you're *not* "using" it.

In a terminal --

prompt$ rvm list

You'll see what rubies you have installed under rvm. Pick one, e.g.

prompt$ rvm use 1.8.7

prompt$ rvm gemset list # now pick one of those, e.g.

prompt$ rvm use [email protected]

prompt$ gem list

Now, forgetting about 'sudo' altogether, which you shouldn't use with
RVM (unless you're explicitly using the `system` ruby) install the gems
you need.

prompt$ gem install ruby-opengl

If at any point you have an error, STOP and figure out what's wrong
instead of just blindly cascading errors into the dog's breakfast you've
described above.

HTH, and good luck,
 
P

Piotr S.

I am using rvm with 1.9.2 version and by what I said before I meant that
there was an older version of ruby preinstalled in my system (ubuntu
10.10).

I couldn't find a solution to my problems and then it somehow worked
using sudo (gem installation) therefore I was wondering if there is a
different way to do it.

There is only one error (without sudo)
"ERROR: Failed to build gem native extension" and then there is a bunch
of stuff with "'bin_path': can't find executable rake for rake-0.8.7"
somewhere in the first couple of lines.
I was searching through some forums where this error was appearing
because of white spaces in Windows folders. But I'm using linux and
everything seems fine especially because it is all working just fine
using 'sudo'.
 
H

Hassan Schroeder

I am using rvm with 1.9.2 version and by what I said before I meant that
there was an older version of ruby preinstalled in my system (ubuntu
10.10).

I couldn't find a solution to my problems and then it somehow worked
using sudo (gem installation) therefore I was wondering if there is a
different way to do it.

There is only one error (without sudo)
"ERROR: Failed to build gem native extension" and then there is a bunch
of stuff with "'bin_path': can't find executable rake for rake-0.8.7"
somewhere in the first couple of lines.
I was searching through some forums where this error was appearing
because of white spaces in Windows folders. But I'm using linux and
everything seems fine especially because it is all working just fine
using 'sudo'.

If it's "all working just fine" then why are you posting?

Alternatively, if you want to use the rvm version of Ruby, then fix the
problem installing the gem you want.

At least, that's what I would do.
 
Ad

Advertisements

P

Piotr S.

The installation is working (with sudo). But I can't use the gem in my
project as it's outside of the rvm's scope.

I have no idea why you don't understand what I'm trying to say.
Seriously I said it's a little confusing but you disagreed with me.

I CAN install this gem using 'sudo gem install' but then I can't use it
in rvm. I CAN'T install this gem without sudo just by 'gem install'
because it produces said error.
 
H

Hassan Schroeder

I CAN install this gem using 'sudo gem install' but then I can't use it
in rvm. I CAN'T install this gem without sudo just by 'gem install'
because it produces said error.

What error? Instead of vaguely describing it, why don't you *fix* it?

You could start by saying *exactly* what gem and version you're
talking about, and showing the *entire error message*.
 
P

Piotr S.

Entire error message:

gem install ruby-opengl
Building native extensions. This could take a while...
ERROR: Error installing ruby-opengl:
ERROR: Failed to build gem native extension.

/home/red/.rvm/rubies/ruby-1.9.2-p136/bin/ruby -rubygems
/home/red/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/bin/rake
RUBYARCHDIR=/home/red/.rvm/gems/ruby-1.9.2-p136/gems/ruby-opengl-0.60.1/lib
RUBYLIBDIR=/home/red/.rvm/gems/ruby-1.9.2-p136/gems/ruby-opengl-0.60.1/lib
/home/red/.rvm/rubies/ruby-1.9.2-p136/bin/ruby mkrf_conf.rb
(in /home/red/.rvm/gems/ruby-1.9.2-p136/gems/ruby-opengl-0.60.1)
rake
/home/red/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/rubygems.rb:340:in
`bin_path': can't find executable rake for rake-0.8.7 (Gem::Exception)
from /home/red/.rvm/gems/ruby-1.9.2-p136/bin/rake:19:in `<main>'
rake aborted!
Command failed with status (1): [rake...]
/home/red/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/rake.rb:993:in
`block in sh'
/home/red/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/rake.rb:1008:in
`call'
/home/red/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/rake.rb:1008:in
`sh'
/home/red/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/rake.rb:1092:in
`sh'
/home/red/.rvm/gems/ruby-1.9.2-p136/gems/mkrf-0.2.3/lib/mkrf/rakehelper.rb:8:in
`block in rake'
/home/red/.rvm/gems/ruby-1.9.2-p136/gems/mkrf-0.2.3/lib/mkrf/rakehelper.rb:7:in
`chdir'
/home/red/.rvm/gems/ruby-1.9.2-p136/gems/mkrf-0.2.3/lib/mkrf/rakehelper.rb:7:in
`rake'
/home/red/.rvm/gems/ruby-1.9.2-p136/gems/mkrf-0.2.3/lib/mkrf/rakehelper.rb:65:in
`block in setup_extension'
/home/red/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/rake.rb:634:in
`call'
/home/red/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/rake.rb:634:in
`block in execute'
/home/red/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/rake.rb:629:in
`each'
/home/red/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/rake.rb:629:in
`execute'
/home/red/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/rake.rb:595:in
`block in invoke_with_call_chain'
/home/red/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/monitor.rb:201:in
`mon_synchronize'
/home/red/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/rake.rb:588:in
`invoke_with_call_chain'
/home/red/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/rake.rb:605:in
`block in invoke_prerequisites'
/home/red/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/rake.rb:602:in
`each'
/home/red/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/rake.rb:602:in
`invoke_prerequisites'
/home/red/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/rake.rb:594:in
`block in invoke_with_call_chain'
/home/red/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/monitor.rb:201:in
`mon_synchronize'
/home/red/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/rake.rb:588:in
`invoke_with_call_chain'
/home/red/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/rake.rb:605:in
`block in invoke_prerequisites'
/home/red/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/rake.rb:602:in
`each'
/home/red/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/rake.rb:602:in
`invoke_prerequisites'
/home/red/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/rake.rb:594:in
`block in invoke_with_call_chain'
/home/red/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/monitor.rb:201:in
`mon_synchronize'
/home/red/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/rake.rb:588:in
`invoke_with_call_chain'
/home/red/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/rake.rb:581:in
`invoke'
/home/red/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/rake.rb:2041:in
`invoke_task'
/home/red/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/rake.rb:2019:in
`block (2 levels) in top_level'
/home/red/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/rake.rb:2019:in
`each'
/home/red/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/rake.rb:2019:in
`block in top_level'
/home/red/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/rake.rb:2058:in
`standard_exception_handling'
/home/red/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/rake.rb:2013:in
`top_level'
/home/red/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/rake.rb:1992:in
`run'
/home/red/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/bin/rake:31:in
`<main>'


Gem files will remain installed in
/home/red/.rvm/gems/ruby-1.9.2-p136/gems/ruby-opengl-0.60.1 for
inspection.
Results logged to
/home/red/.rvm/gems/ruby-1.9.2-p136/gems/ruby-opengl-0.60.1/gem_make.out
 
S

Steve Klabnik

[Note: parts of this message were removed to make it a legal post.]

What you want is this:

rvmsudo gem install

rvm works by changing your $PATH. When you switch users with sudo, that
changes your $PATH too. rvmsudo lets you also temporarily change the $PATH
of your administrator account, so that you can install gems properly while
still having increased permissions.
 
P

Piotr S.

To my surprise it isn't working. rvmsudo gem install ruby-opengl still
gives me the same error.
I checked and installed ruby-opengl with 'sudo gem install' and it's
working.
 
Ad

Advertisements

H

Hassan Schroeder

To my surprise it isn't working. rvmsudo gem install ruby-opengl still
gives me the same error.
I checked and installed ruby-opengl with 'sudo gem install' and it's
working.

It's not that you're doing it as root, it's that you're using a different
(system) version of Ruby.

It installs for me (Mac OS 10.6.6) just fine using 1.8.7, but fails in the
same way with 1.9.2. Are you sure the gem itself works with 1.9.2?
 
P

Piotr S.

it says "Proper support for ruby 1.9/1.9.1+" so I assumed that it will
work just fine with 1.9.2 as I never had any problems with any other
gem.
 
H

Hassan Schroeder

it says "Proper support for ruby 1.9/1.9.1+" so I assumed that it will
work just fine with 1.9.2 as I never had any problems with any other
gem.

ripple:~$ rvm use 1.9.1-p243
Using /Users/hassan/.rvm/gems/ruby-1.9.1-p243
ripple:~$ gem list

*** LOCAL GEMS ***

bundler (1.0.9)
rake (0.8.7)
rubygems-update (1.4.2)
ripple:~$ gem install ruby-opengl
Fetching: mkrf-0.2.3.gem (100%)
Fetching: ruby-opengl-0.60.1.gem (100%)
Building native extensions. This could take a while...
Successfully installed mkrf-0.2.3
Successfully installed ruby-opengl-0.60.1
2 gems installed
rripple:~$ rvm use [email protected]
Using /Users/hassan/.rvm/gems/ruby-1.9.2-p0 with gemset global
ripple:~$ gem install ruby-opengl
Building native extensions. This could take a while...
ERROR: Error installing ruby-opengl:
ERROR: Failed to build gem native extension.

/Users/hassan/.rvm/rubies/ruby-1.9.2-p0/bin/ruby -rubygems
/Users/hassan/.rvm/gems/[email protected]/gems/rake-0.8.7/bin/rake
RUBYARCHDIR=/Users/hassan/.rvm/gems/[email protected]/gems/ruby-opengl-0.60.1/lib
RUBYLIBDIR=/Users/hassan/.rvm/gems/[email protected]/gems/ruby-opengl-0.60.1/lib
/Users/hassan/.rvm/rubies/ruby-1.9.2-p0/bin/ruby mkrf_conf.rb
(in /Users/hassan/.rvm/gems/[email protected]/gems/ruby-opengl-0.60.1)
rake
/Users/hassan/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:340:in
`bin_path': can't find executable rake for rake-0.8.7 (Gem::Exception)
from /Users/hassan/.rvm/gems/ruby-1.9.2-p0/bin/rake:19:in `<main>'


You might want to rethink that assumption :)
 
Ad

Advertisements

L

Luis Lavena

Entire error message:

gem install ruby-opengl
Building native extensions.  This could take a while...
ERROR:  Error installing ruby-opengl:
  ERROR: Failed to build gem native extension.

/home/red/.rvm/rubies/ruby-1.9.2-p136/bin/ruby -rubygems
/home/red/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/bin/rake
RUBYARCHDIR=/home/red/.rvm/gems/ruby-1.9.2-p136/gems/ruby-opengl-0.60.1/lib
RUBYLIBDIR=/home/red/.rvm/gems/ruby-1.9.2-p136/gems/ruby-opengl-0.60.1/lib
/home/red/.rvm/rubies/ruby-1.9.2-p136/bin/ruby mkrf_conf.rb
(in /home/red/.rvm/gems/ruby-1.9.2-p136/gems/ruby-opengl-0.60.1)
rake
/home/red/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/rubygems.rb:340:in
`bin_path': can't find executable rake for rake-0.8.7 (Gem::Exception)
  from /home/red/.rvm/gems/ruby-1.9.2-p136/bin/rake:19:in `<main>'
rake aborted!

find rake.gemspec that is inside ruby-1.9.2-p136/lib/ruby/ and remove
it.

install rake again (gem install rake).

Then gem install ruby-opengl again.

There must be something that gem is doing during the extension
compilation phase, perhaps "sudo form inside of it" that is affecting
RVM functionality.

But try above steps first. Can't find rake is a problem of Ruby 1.9.2-
p0 and p136 is already fixed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top