FAQ › Installation and system operation

gem install mysql fails during the installation of Redmine

Created on 2009-04-06  •  MAEDA Go

On Red Hat Enterprise Linux / CentOS, gem install mysql sometimes fails with an error like the following.

# gem install mysql
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
    ERROR: Failed to build gem native extension.

/usr/local/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.

The search for the MySQL client library has failed. Run the command again and specify the directory that contains the library, as follows.

# gem install mysql -- --with-mysql-lib=/usr/lib/mysql