mysql gem install error on Mac OS X - 'ulong' undeclared error

Hi,

I can’t seem to install the mysql gem for Ruby (see errors below). I get an ‘ulong’ undeclared error. Can anyone assist?

============ERROR=========================

Macintosh:mysql-2.7 greg$ sudo gem install mysql – --with-mysql-config=/usr/local/mysql/bin/mysql_config

Password:

Building native extensions. This could take a while…

ERROR: Error installing mysql:

ERROR: Failed to build gem native extension.

/opt/local/bin/ruby extconf.rb install mysql – --with-mysql-config=/usr/local/mysql/bin/mysql_config

checking for mysql_ssl_set()… yes

checking for mysql.h… yes

creating Makefile

make

gcc -I. -I. -I/opt/local/lib/ruby/1.8/i686-darwin8.10.1 -I. -DHAVE_MYSQL_SSL_SET -DHAVE_MYSQL_H -I/opt/local/include -I/usr/local/mysql/include -Os -arch i386 -fno-common -fno-common -O2 -fno-common -pipe -fno-common -c mysql.c

mysql.c: In function ‘Init_mysql’:

mysql.c:2015: error: ‘ulong’ undeclared (first use in this function)

mysql.c:2015: error: (Each undeclared identifier is reported only once

mysql.c:2015: error: for each function it appears in.)

mysql.c:2015: error: syntax error before numeric constant

mysql.c:2018: error: syntax error before numeric constant

make: *** [mysql.o] Error 1

Gem files will remain installed in /opt/local/lib/ruby/gems/1.8/gems/mysql-2.7 for inspection.

Results logged to /opt/local/lib/ruby/gems/1.8/gems/mysql-2.7/gem_make.out

===========VERSION INFO==========================

Macintosh:mysql-2.7 greg$ ruby --version

ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-darwin8.10.1]

Macintosh:mysql-2.7 greg$ rails --version

Rails 2.0.2

Macintosh:mysql-2.7 greg$ gem --version

1.1.0

=========MacBook Details============================

Model Name: MacBook

Model Identifier: MacBook2,1

Processor Name: Intel Core 2 Duo

Processor Speed: 2 GHz

System Version: Mac OS X 10.5.2 (9C7010)

Kernel Version: Darwin 9.2.2

Regards

Greg

I can't seem to install the mysql gem for Ruby (see errors below). I get an 'ulong' undeclared error. Can anyone assist?

Hopefully this will help...

http://jlaine.net/2006/10/3/installing-ruby-mysql-driver-on-os-x

(read through the comments as well)

Philip Hallstrom wrote:

I can't seem to install the mysql gem for Ruby (see errors below). I get an 'ulong' undeclared error. Can anyone assist?

Hopefully this will help...

http://jlaine.net/2006/10/3/installing-ruby-mysql-driver-on-os-x

(read through the comments as well)

I have tried the solutions above and no success. Finally I decided to add #define ulong unsigned long to /usr/include/stdlib.h and tried installing again and voila, it worked !

Have also suggested this solution to many people and so far have not found any issues with it.