Categories
Computers Linux

Problem installing MySQL Ruby bindings

In a previous article I outlined the installation of a Rails environment on Ubuntu 8.04. That article fails when the target system is a clean installation of Ubuntu 8.04 since it would then be lacking the essential build environment. This is manifested when installing the native extensions for MySQL using “gem install mysql” and the error message shown is:

root@hobbit:~# 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 install mysql
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... no
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... no
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.

To fix this, just install build-essential, i.e. “apt-get install build-essential”.

css.php