jmhobbs

MySQL & Ruby on Debian (sidux)

I've started learning Ruby on Rails, and I needed the mysql driver. Should be simple, right? Just gem install mysql or something?

It wasn't.

root@asuka:~# gem install mysql
Building native extensions.  This could take a while...                                                                              
ERROR:  Error installing mysql:                                                                                                      
        ERROR: Failed to build gem native extension.                                                                                 

/usr/bin/ruby1.8 extconf.rb
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/mysql-2.7 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/mysql-2.7/gem_make.out
root@asuka:~#

Once tangled mess of Google, Debian, and Ruby later, I found a bug report and a solution (for me at least).

Debian Bug 373843 - Long story short, you need ruby1.8-dev or, it appears, libmysql-ruby.