Saturday, March 28, 2009

Install "mysql" gem in cygwin

mysql gem

Tried "gem install mysql". That failed. Errors went like this:

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

/usr/bin/ruby.exe 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... 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.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
... lotsa stuff deleted ...

Solution

The strategy is to download and build the needed libraries and other resourced so the mysql gem can be built and installed.
  1. Download the mysql source package.
  2. Use tar() to unwind the tarball into a directory. This was "mysql-5.1.32" for me. "tar xvfz mysql-5.1.32.tar.gz"
  3. "./configure" ... Get get a cup of something.
  4. make" ... Bugger, bugger, bugger. The build failed.
... stuff deleted ...
In file included from readline.c:54:
readline/readline.h:70:29: sys/ttydefaults.h: No such file or directory
make[2]: *** [readline.o] Error 1
... stuff deleted ...

Tried using the -exclude-server flag when running make(), as was suggested in other web locations. Same failure in the same place. No progress there.

Bugger, again!

cd() into the client directory. Do a "make" and am able to build it. Woohoo! Progress? Now, what .so and .h files should be copied to what destination directories? I don't know.

I find others on the web talking about these issues, but I don't find solutions.


Maybe it is just not going to work on XP, like so many other things. I should just wipe XP off this laptop and install Ubuntu. Just can't quite do that yet. Piece of shit.

A friend made a suggestion ... configure jruby. There are some potential benifits:
  • Most server environments already have java configured.
  • Most admins feel comfortable about installing a java module.
  • The performance is supposed to be very good, perhaps better than a native install. I'm skeptical. Who knows?
Perhaps I'll give that a last shot.

No comments: