Whenever I do a fresh install of Ubuntu, and I’m setting up Ruby, Rails, I always run into the same problem with a handful of gems (such as Mongrel & Hpricot). This is how things usually go down:
matt@thinkpad:~$ sudo gem install hpricot Building native extensions. This could take a while... ERROR: Error installing hpricot: ERROR: Failed to build gem native extension. /usr/bin/ruby1.8 extconf.rb install hpricot extconf.rb:1:in `require': no such file to load -- mkmf (LoadError) from extconf.rb:1 Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/hpricot-0.6 for inspection. Results logged to /usr/lib/ruby/gems/1.8/gems/hpricot-0.6/ext/hpricot_scan/gem_make.out
Now what? The main problem here is that Hpricot and Mongrel both contain some C code that needs to be compiled. In order to fix this, you’ll need to install the Ruby & C development libraries for Ubuntu. To do that, just fire up Terminal and enter:
sudo apt-get install ruby1.8-dev linux-libc-dev libc6-dev
You should now be able to install Hpricot, Mongrel, or any other gem that requires you to build some C. It’s that easy!
Hi,
In Fedora 9, it must be installled like that:
su
"password root"
yum install ruby-devel
gem install hpricot
Bye!!
This works just fine!!! Thanks!!!
Didn’t know how to approach that error message… but google let me discover your beautiful site.
Thank you very much
Awesome! Worked like charm!=)