Al Hoang

October 27, 2006

Fixing ‘mkmf’ load error Ruby in Ubuntu

Filed under: linux, programming, ruby — hoanga @ 12:15 am

If you’re a Debian or Ubuntu user you’ll find that the Ruby standard

distribution is split into lots of little packages so doing something like

apt-get install ruby

only gives you the ruby binary and a subset of the libraries for Ruby. You’ll

need to add more packages if you want to utilize more of Ruby’s standard

library. This is all in order to comply with

Debian packaging Guidelines.

That is all well and good but a little frustrating when you ‘just want to

do work’.

For example, I wanted to install

sys-proctable

(Something I really believe should be in Ruby’s standard distribution)

however ran into the following:

$ sudo gem install sys-proctable

Building native extensions. This could take a while…

extconf.rb:8:in `require’: no such file to load — mkmf (LoadError)

    from extconf.rb:8

ERROR: While executing gem … (RuntimeError)

   ERROR: Failed to build gem native extension.

Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/sys-proctable-0.7.3 for inspection.

To get around this you will need to install ruby1.8-dev (or ruby1.6-dev or

whatever version of ruby you’re running) to get mkmf.rb which is listed

in the Ruby Standard Library.

I’m sure most Ruby hackers worth their salt consider this a ‘duh’ thing

but not of all of us can be shining stars in the Ruby community

How I fixed it…

$ sudo apt-get install ruby1.8-dev

..

$ sudo gem install sys-proctable

Need to update 4 gems from 

7 Comments »

  1. Brian Rowe

    December 18, 2006 @ 1:05 pm

    1

    Thank you!! I am running Gentoo and slowly moving to Ubuntu and this was killing me. Solved the first problem trying to get ruby-ncurses to work on Ubuntu. I already have this working on Gentoo and OSX. Thanks

  2. Liam

    January 14, 2007 @ 5:44 am

    2

    Thanks! this got me past an issue that was driving me nuts….

  3. Tracy Bahm

    February 7, 2007 @ 10:54 am

    3

    Thanks! This was the trick I needed in order to successfully get the Oracle Rails library installed.

  4. philcrissman.com » Some Twittering With Ruby And Shoes

    November 9, 2007 @ 1:00 am

    4

    [...] search led me to one Al Hoang, who discovered that upgrading to ruby1.8-dev would resolve this — apparently mkmf.rb is not [...]

  5. Software Engineering Blog » Installing ruburple on Ubuntu

    July 1, 2008 @ 5:15 am

    5

    [...] But of course if I had it… I would be having an issue.  I searched more and found this blog post that talked about mkmf and Ubuntu.  It said to install ruby1.8-dev.  Simple enough.  Install the [...]

  6. Informático en apuros » ‘mkmf’, o cómo gruñen los gems en ubuntu

    September 1, 2008 @ 11:44 am

    6

    [...] Su p*** madre. Al menos esto fue googlear medio minuto, y al parecer es problema con mi versión de Kubuntu. Un sencillo sudo apt-get install ruby1.8-dev y solucionado. Cortesía de Al Hoang [...]

  7. FUTU-RISK » Blog Archive » Upgrade of server

    January 7, 2009 @ 8:05 pm

    7

    [...] I got the solution thanks to this guy [...]

Leave a Comment

You must be logged in to post a comment.

Powered by WordPress

Protected by AkismetBlog with WordPress