Are you attempting to install the sqlite3-ruby gem and you are receiving this error?
Building native extensions. This could take a while...
ERROR: Error installing sqlite3-ruby:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
extconf.rb:3:in `require': no such file to load -- mkmf (LoadError)
from extconf.rb:3
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/sqlite3-1.3.3 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/sqlite3-1.3.3/ext/sqlite3/gem_make.out
Well, we have the solution for you. Your Linux installation requires that the development libraries for SQLite3 to be installed in order to build the gem. Here is the proper way for install this gem:
How to install sqlite3-ruby gem
sudo apt-get install sqlite3
sudo apt-get install libsqlite3-dev
sudo gem install sqlite3-ruby
If you are still having trouble….
Try installing the development package of Ruby 1.8 by using the command below, and then attempt to install Sqlite3:
sudo apt-get install ruby1.8-dev
After running the commands you suggest, I am still getting the same error when I try to install the Ruby gem. Any ideas what else I could be missing?
Figured it out! After searching around to uncover why it was failing to load ‘mkmf’, I found that I needed to install the ruby1.8-dev package:
sudo apt-get install ruby1.8-dev
Kudos goes to: http://mentalized.net/journal/2006/01/24/no_such_file_to_load_mkmf/
Thanks, I really appreciate this help. 🙂
Great, after installing ruby1.8-dev, everything installed just as expected! Btw, when installing sqlite3-ruby, i got this sweet little message:
Hello! The sqlite3-ruby gem has changed it’s name to just sqlite3. Rather than
installing `sqlite3-ruby`, you should install `sqlite3`. Please update your
dependencies accordingly.
Thanks from the Ruby sqlite3 team!
<3 <3 <3 <3
maybe you should update your howto, too 😛
Thanks again, suteno
ahah! I run Linux Mint 11 and the command:
sudo apt-get install libsqlite3-dev
is what made the difference, finally I could install the sqlite3 gem
This helped out a lot! Thanks!
That worked! (ruby1.8-dev)
Thanks Matt! I was stuck installing the selenium-webdriver gem, but installing the ruby dev package fixed this error. I thought gems were supposed to figure out dependencies like this?
It worked perfectly!
sudo apt-get install sqlite3
sudo apt-get install libsqlite3-dev
sudo gem install sqlite3-ruby
sudo gem install sqlite3
Thank you very Sood for the suggestion!
Try:
sudo apt-get install ruby-dev
And if your on a Windows Machine?