On Gutsy had a problem installing the Ruby MySQL Gem:
Using:
sudo gem install mysql
gave the error:
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... 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.
To fix:
sudo apt-get install libmysqlclient15-dev
Try again and all should be fine ![]()




Thanks for this… saved me a lot of time figuring it to compile.
This old post saved my life, thanks a lot
THANK YOU!
Here’s another way to solve this problem (if you already have MySQL installed somewhere):
http://forums.mysql.com/read.php?116,157273,175993#msg-175993
For me I needed to do:
$ sudo gem install mysql — –with-mysql-lib=/opt/lampp/lib/mysql
Select which gem to install for your platform (i486-linux)
1. mysql 2.7.3 (mswin32)
2. mysql 2.7.1 (mswin32)
3. mysql 2.7 (ruby)
4. mysql 2.6 (ruby)
5. Skip this gem
6. Cancel installation
> 3
Building native extensions. This could take a while…
Successfully installed mysql-2.7
Yiihaa! Tried 3 different posts on this problem, they all contained bits of information, but this one saved the day.
This worked for me -
gem install mysql — –with-mysql-config=/usr/lib/mysql/mysql_config
Big thanks for you