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!

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
Abhi
Woah, I’m not 100% sure on this one. Starting with the obvious: It’s having difficulty compiling the C extension for ruby-opengl. So, do you have all the requisite libraries installed? (see here: http://ruby-opengl.rubyforge.org/build_install.html). If that doesn’t fix it, could you post a more complete log of the output? (put it here: http://pastie.org , so it looks nice)
Tyler
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!