ruby-opengl on Ruby 1.9

So a couple days ago I was trying to install the ruby-opengl gem on
ruby 1.9, and I kept getting this error:

/usr/bin/ld: cannot find -lruby

I use rvm (Ruby Version Manager), so all my rubies are compiled from source. It turns out that you need to compile ruby 1.9 with the --enable-shared configure option to get the linker libraries needed to compile ruby-opengl.

To do this with rvm:

rvm remove 1.9.1 # First remove ruby so we can recompile it
rvm install 1.9.1 -C --enable-shared # Install and compile with the correct option
rvm use 1.9.1
gem install ruby-opengl

And you’re all set with the ruby-opengl gem!


~ by Tyler Church on April 16, 2010.

3 Responses to “ruby-opengl on Ruby 1.9”

  1. Hi Tyler
    I am also riding the same boat. I followed the instruction above. All the steps work except for the last one where you are trying to install the ‘ruby-opengl’ gem. I could make the rvm use ruby version 1.9.2 on my ubuntu box. The error message that I am getting is

    “ERROR: Failed to build gem native extension.”

    rake aborted!

    Gem files will remain installed in… for inspection.

    It would be great if you helped me out.
    Thanks in Advance

  2. I was having them same error installing ruby-opengl gem, the problem was with ruby 1.9.2

    Switching to ruby 1.9.1 with rvm solved the problem, the gem installed fine!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: