Tip to compile a 32bit version of Ruby on Snow Leopard

Hi guys,

I hope it's not too off topic on a Rails forum, but I spent so much time on this I thought I should share it here - hopefully it will help other people.

I had to compile a 32bit (i386) version of Ruby 1.8.7 on Snow Leopard (my app is using a 32bit only lib). So I configured the compilation as such: ./configure CFLAGS="-arch i386 -D_XOPEN_SOURCE=1" LDFLAGS="-arch i386" --enable-shared --enable-pthread

It seems to me that's the standard way to do this... but it doesn't work. Indeed, the "-arch i386" param is not passed to a cc call during the compilation (the compilation fails since it uses a 64bit version of a lib, instead of the 32 one).

I manually updated the Makefile (after executing ./configure with the params above):

LDSHARED = cc -arch i386 -dynamiclib -undefined suppress - flat_namespace

(adding -arch i386)

and the compilation worked fine.

Thanks, Pierre