FIX: checking for mysql_query() in -lmysqlclient… no

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 :)

6 Responses to “FIX: checking for mysql_query() in -lmysqlclient… no”


  1. 1 Erwin Quita Mar 6th, 2008 at 1:12 pm

    Thanks for this… saved me a lot of time figuring it to compile.

  2. 2 SolidMax Jun 27th, 2008 at 2:23 am

    This old post saved my life, thanks a lot

  3. 3 lucas luky Jul 16th, 2008 at 6:54 pm

    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

  4. 4 karatedog Feb 11th, 2009 at 1:57 am

    Yiihaa! Tried 3 different posts on this problem, they all contained bits of information, but this one saved the day.

  5. 5 smr May 6th, 2009 at 9:06 am

    This worked for me -
    gem install mysql — –with-mysql-config=/usr/lib/mysql/mysql_config

  6. 6 zakwanhaj May 17th, 2009 at 9:22 am

    Big thanks for you

Leave a Reply






Add to Technorati Favorites
Zen Handbook

Latest Posts

RSS