Gem install mysql "checking for mysql_query() in -lmysqlclie

I’ve seen this before but I’ve forgotten how to solve it.

It appears that I have the mysql client libraries installed:

iono@retro[08:25:55][~/] locate libmysqlclient.so

/usr/lib/mysql3/mysql/libmysqlclient.so

/usr/lib/mysql3/mysql/libmysqlclient.so.10

/usr/lib/mysql3/mysql/libmysqlclient.so.10.0.0

/usr/lib/mysql/libmysqlclient.so

/usr/lib/mysql/libmysqlclient.so.14

/usr/lib/mysql/libmysqlclient.so.10

/usr/lib/mysql/libmysqlclient.so.10.0.0

/usr/lib/mysql/libmysqlclient.so.14.0.0

My LD_LIBRARY_PATH is:

export
LD_LIBRARY_PATH=/usr/lib/oracle/10.2.0.4/client64/lib:/usr/lib/mysql/

OS:

Linux XYZ 2.6.18-128.1.6.el5 #1 SMP Tue Mar 24 12:05:57 EDT 2009 x86_64
x86_64 x86_64 GNU/Linux

What gives?

Full “gem install mysql” output follows:

ERROR: Error installing mysql:

    ERROR: Failed to build gem native extension.

/home/iono/packages/ruby-1.8.7/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

*** 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.

Provided configuration options:

    --with-opt-dir

    --without-opt-dir

    --with-opt-include

    --without-opt-include=${opt-dir}/include

    --with-opt-lib

    --without-opt-lib=${opt-dir}/lib

    --with-make-prog

    --without-make-prog

    --srcdir=.

    --curdir

    --ruby=/home/iono/packages/ruby-1.8.7/bin/ruby

    --with-mysql-config

    --without-mysql-config

    --with-mysql-dir

    --without-mysql-dir

    --with-mysql-include

    --without-mysql-include=${mysql-dir}/include

    --with-mysql-lib

    --without-mysql-lib=${mysql-dir}/lib

    --with-mysqlclientlib

    --without-mysqlclientlib

    --with-mlib

    --without-mlib

    --with-mysqlclientlib

    --without-mysqlclientlib

    --with-zlib

    --without-zlib

    --with-mysqlclientlib

    --without-mysqlclientlib

    --with-socketlib

    --without-socketlib

    --with-mysqlclientlib

    --without-mysqlclientlib

    --with-nsllib

    --without-nsllib

    --with-mysqlclientlib

    --without-mysqlclientlib

Gem files will remain installed in
/home/iono/packages/gems/gems/mysql-2.7 for inspection.

I’ve had this issue before - I’m pretty sure I ended up solving it by
installing the mysql-devel package first.

On Apr 15, 10:33 am, Rob R. [email protected]

/home/iono/packages/gems/gems/mysql-2.7 for inspection.

Might give some clues.

Roger P. wrote:

/home/iono/packages/gems/gems/mysql-2.7 for inspection.

Might give some clues.

Duh.

This is what worked:
cd /home/iono/packages/gems/gems/mysql-2.7
ruby extconf.rb --with-mysql-config=/usr/bin/mysql_config

Thanks for such speedy help!!

R

Rob R. wrote:

Roger P. wrote:

/home/iono/packages/gems/gems/mysql-2.7 for inspection.

Might give some clues.

Duh.

This is what worked:
cd /home/iono/packages/gems/gems/mysql-2.7
ruby extconf.rb --with-mysql-config=/usr/bin/mysql_config

Thanks for such speedy help!!

R

For completeness, I then did (as per README.html):
make
make install

Testing ActiveRecord through mysql now seems to work well.

R