If you get the error below while trying to install the ruby mysql gem on Suse 10 then follow the instuctions below to get it going:
incei273:~ # gem install mysql
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 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
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.
Checking the mkmf.log in:
{ruby-dir}/gems/1.8/gems/mysql-2.7/mkmf.log
… shows libmysql is missing. But looking in /usr/lib/mysql shows some libmysqlclient*.so files but GCC actually needs the .a files.
So fire up yast and install the mysql-devel package.
Then install the Ruby Mysql Gem using:
gem install mysql — –with-mysql-lib=/usr/lib/mysql/