HOWTO compile MySQL/Ruby under Cygwin

$Id: compile-mysql-cygwin,v 1.1 2001/10/19 11:35:16 michael Exp $

by Michael Neumann

Step 1 - Building the client library for Mysql

Download

Download the sources for MySQL, e.g. mysql-3.23.43.tar.gz from <URL:http://sourceforge.net/projects/mysql/>.

Extract

tar -xvzf mysql-3.23.43.tar.gz

cd mysql-3.23.43

Configure, Build and Install

./configure --without-server

make && make install

Step 2 - Building the MySQL/Ruby package

Download

Download the MySQL/Ruby package, e.g. mysql-ruby-2.4.tar.gz from <URL:http://www.ruby-lang.org/en/raa-list.rhtml?name=MySQL/Ruby>.

Extract

tar -xvzf mysql-ruby-2.4.tar.gz

cd mysql-ruby-2.4

Patch

Edit file extconf.rb. Append " -lz -lm" to $libs.

Apply the following patch to file mysql.c:

878c878
<     extern VALUE rb_eStandardError;
---
>     // extern VALUE rb_eStandardError;

Configure, Build and Install

ruby extconf.rb

make && make install

Test it

ruby -r mysql -e "Mysql.connect('localhost')"
...