MySQL/MySQL2 Gem on Solaris
February 17 2012 10:28 CET
Setting up MySQL 5.1 and the MySQL/MySQL2 gem on Solaris can cause some problems because it looks for the include/lib files in the wrong place.
By default Solaris pkg installs MySQL to /usr/mysql/ (with symlinks to the appropriate version eg. 5.1).
So if you are getting this when doing gem install mysql/mysql2:
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb -with-mysql-dir=/usr/mysql/
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... no
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... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... 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.
Just adjust like this:
pkg install mysql-51
pkg install mysql-51/library
gem install mysql2 -- --with-mysql-dir=/usr/mysql --with-mysql-lib=/usr/mysql/lib --with-mysql-include=/usr/mysql/include/mysql/
Note also that pkg install mysql-51 doesn’t install the required libraries hence you need to pkg install mysql-51/library.
Comments