I have a brand spanking new laptop, and it needs a brand spanking new Ruby on Rails development environment. This being Windows, the only sane way to get a good pile of development tools and a usable shell is to install Cygwin. I’ve had it set up on the old laptop for a while now, and while it’s slow (mostly because that laptop is old, and therefore slow), it works well as a Rails environment.
Of course, every time I set this up there has to be a snag in the process, right? Rails hasn’t shipped with MySQL support for a few versions now, so it’s necessary to manually install a MySQL gem. Unfortunately, there aren’t any library files available for Rubygems to compile against, because the Windows version of MySQL doesn’t install any. If it did, they’d be somewhere Cygwin wouldn’t know about them, anyhow; the MySQL folks don’t officially support Cygwin.
So, to get the library, I downloaded the MySQL source, popped open the tarball, and ran through the usual configure, make, make install routine. The only difference is the addition of the --without-server flag for configure; there’s no need to build the whole server, because that’s already been installed using the Windows binary installer.
Unfortunately, it wasn’t that easy, because Cygwin doesn’t ship with the sys/ttydefaults.h header file. I’ve read forum conversations that imply you can get the file by installing the GNU readline package, but that didn’t fix the problem. Fortunately, you can snag the file from another unix (or grab the copy here), drop it into the /usr/include/sys directory (Windows path: c:\cygwin\usr\include\sys), and that makes the compiler happy.
> ./configure --without-server > make > make install
After that all finishes (and it takes a while, even on the swanky new speed machine), I installed the Ruby mysql gem.
> gem install mysql
Kind of anticlimactic, really. Even the “building native extensions” part of the gem installation is orders of magnitude shorter than compiling MySQL. And a whole hell of a lot quicker than tracking down why things won’t compile. It’s been a long day of watching a console spit reams of text at me.
One Comment
Cheers for the advise on this, I ran into an additional problem about half way through the mysql build, I got the error
error: `my_thread_var’ undeclared (first use in this function)
turns out its a newly found bug, luckily there’s a patch available here
http://lists.mysql.com/commits/86246