End to the madness, or “How to install the ruby mysql adaptor on CentOS”

Posted by Michael Wed, 08 Feb 2006 21:14:00 GMT

This was the end to a frustrating several hours a couple months ago. The mysql module wouldn’t install via Ruby Gems. I kept getting:

[root@zeus dynamic]# gem install mysql -with-mysql-config
Attempting local installation of 'mysql'
Local gem file not found: mysql*.gem
Attempting remote installation of 'mysql'
Building native extensions. This could take a while...
ERROR: While executing gem ... (RuntimeError)
ERROR: Failed to build gem native extension.
Gem files will remain installed in th-mysql-config/gems/mysql-2.7 for inspection.
ruby extconf.rb install mysql -with-mysql-config\nchecking 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
Results logged to /tmp/fgci_ipc/dynamic/th-mysql-config/gems/mysql-2.7/gem_make.out

So I got the Ruby mysql sources and ran:

[root@zeus dynamic]# cd /root/downloads/mysql-ruby-2.7
[root@zeus mysql-ruby-2.7]# ruby extconf.rb --with-mysql-config
checking for mysql_ssl_set()... yes
checking for mysql.h... yes
creating Makefile

[root@zeus mysql-ruby-2.7]# make
gcc -fPIC -g -O2 -I. -I/usr/local/lib/ruby/1.8/i686-linux -I/usr/local/lib/ruby/1.8/i686-linux -I. -DHAVE_MYSQL_SSL_SET -DHAVE_MYSQL_H -I/usr/include/mysql -g -pipe -m32 -march=i386 -mtune=pentium4 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -c mysql.c
gcc -shared -L'/usr/local/lib' -Wl,-R'/usr/local/lib' -o mysql.so mysql.o -L/usr/lib/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -L/usr/lib -lssl -lcrypto -ldl -lcrypt -lm -lc

[root@zeus mysql-ruby-2.7]# make install
install -c -p -m 0755 mysql.so /usr/local/lib/ruby/site_ruby/1.8/i686-linux

That’s it.

Posted in  | no comments

Comments

Comments are disabled