Building Gems on Ubuntu
October 11th, 2008 by ScottK | 3 Comments | Filed in rubyI thought I would just pop in and tell you how on a fresh install of Ubuntu 8.04 I ran into some issues trying to get ruby gems to install. After some research and poking/prodding I’ve come up with the solutions.
Being that this is a fresh install of Ubuntu I did go ahead and apt-get ruby1.8 and rubygems just to kick things off a bit before installing rails and my reguire gems. After the apt-get rubygems install I wanted to update the gems I had by running “sudo gem update –system”. That ran fine.
So now was the time to install rails by using “sudo gem install rails” Big fail as I got an error. “/usr/bin/gem:24: uninitialized constant Gem::GemRunner (NameError)
†Well shit! After some looking it seems that you can add this line to the /usr/bin/gem file: “require ‘rubygems/gem_runner’” after the “require ‘rubygems’”.
require 'rubygems' # Add the below line require 'rubygems/gem_runner'
That worked fine for the rails install. However I ran into a new problem. “extconf.rb:1:in `require’: no such file to load — mkmf (LoadError)â€. This was easily fixed by “sudo apt-get install ruby1.8-dev”. Seems that some gems require the ruby source files to build. Having them is necessary.
However…
Those that needed the ruby dev started to throw a ton of errors during the “make” portion. It turned out I also needed to “sudo apt-get install g++” as well.
Once I did that all gems installed just fine. So if you have just installed Ubuntu Hardy Haron or are getting any of the three errors then there is what I did. Make sure to edit the /usr/bin/gem file. apt install ruby1.8-dev and g++.
