ERROR: Failed to build gem native extension.

I ran into a tiny pickle while installing the ibm_db gem on Ubuntu:

Select which gem to install for your platform (i486-linux)
 1. ibm_db 0.9.5 (ruby)
 2. ibm_db 0.9.5 (mswin32)
 3. ibm_db 0.9.4 (ruby)
 4. ibm_db 0.9.4 (mswin32)
 5. Skip this gem
 6. Cancel installation
> 1
Building native extensions.  This could take a while...
ERROR:  While executing gem ... (Gem::Installer::ExtensionBuildError)
    ERROR: Failed to build gem native extension.

ruby extconf.rb install ibm_db
extconf.rb:9:in `require': no such file to load -- mkmf (LoadError)
	from extconf.rb:9

The problem is that mkmf isn’t included in the base Ruby package on Ubuntu. You need need the full development package to install gems from source. Installing it solves the problem.

sudo apt-get install ruby1.8-dev

Comments

6 responses to “ERROR: Failed to build gem native extension.”

  1. Error: please fill the required fields (name, email). Avatar
    Error: please fill the required fields (name, email).

    pickles are in python not ruby 🙂

  2. Leons Petrazickis Avatar

    I think you will find that they are actually in PHP, what with PECL and all.

    http://pecl.php.net/

  3. Faisal Avatar

    Thanks a lot it solved my problem.I was missing the package i.e ruby1.8-dev

  4. cz9qvh Avatar
    cz9qvh

    Thank you, that helped a bunch.

  5. isomorphisms Avatar

    Hmm, I have this error with gem install idn and I do have ruby1.9.1-dev selected.

  6. devolute Avatar

    This fixed everything when I did `sudo apt-get install ruby1.9.1-dev`. Cheers!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.