views:

165

answers:

2

So, installing Ruby Enterprise Edition went fairly smoothly (except for a very odd quirk of the system I'm on, where I had to apt-get install build-essentials because there was no GCC...), but it failed to install any of the database gems properly. I mainly want to use MySQL. Here's the output of Ruby EE's ./installer during the mysql gem installation:

Installing mysql...
/opt/ruby-enterprise-1.8.6-20090610/bin/ruby /opt/ruby-enterprise-1.8.6-20090610/bin/gem install -r --no-rdoc --no-ri --no-update-sources --backtrace mysql
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
        ERROR: Failed to build gem native extension.

/opt/ruby-enterprise-1.8.6-20090610/bin/ruby extconf.rb
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
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... no
*** extconf.rb failed ***

Apparently my server's MySQL installation didn't come with source, so I can't just recompile and hope it works... I tried to download the version and compile that, but I'm not sure what to do from here. Any ideas? MySQL is already running on this server with quite a few databases, so I'd also rather not mess with what's already here...

A: 

Is your system 64bit? The problem is that the gem installer can't find mysqlclient.

1) Use locate to make sure that mysqlclient and mysql_config are on your system. You may need to first update the locate db. -- locate mysqlclient should show you a number of library files ending in .so, .a, etc.

2) Try /opt/ruby-enterprise/bin/ruby /opt/ruby-enterprise/bin/gem install mysql -- --with-mysql-config='/usr/bin/mysql_config' --no-rdoc --no-ri

(update the above to use right dir for mysql_config and ruby-enterprise)

Larry

Larry K
It's 32bit, actually. I did run `locate` to look for it and I don't think it turned up, which is why I turned to `aptitude`.Thanks for the help though!
Twisol
+1  A: 

After a fair bit of struggle, I started browsing through aptitude hoping to find a package that might solve the problem. I found libmysqlclient-dev, installed it, and rebuilt the gem... and it worked. I feel pretty stupid, heh, but this is only my first time trying to deploy a Rails app to a real webserver.

Twisol