Wednesday, February 27, 2008

mysql gem on fedora 8




I was trying to install the mysql Ruby gem on Fedora 8 and got the following error message:


root.devi 38 [/usr/lib/ruby/gems/1.8/gems/mysql-2.7] % gem install mysql
gem install mysql
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.

/usr/bin/ruby extconf.rb install mysql
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... yes
checking for mysql_query() in -lmysqlclient... no


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


Looking in mkmf.log, I found the following at the top:


find_library: checking for mysql_query() in -lmysqlclient... -------------------- no


I found the solution on a post on rubyforums.com, which was to symlink the mysql lib directory to /usr/local/lib, like this:


ln -s /usr/lib/mysql/ /usr/local/lib/mysql