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

**URL:** <https://www.ruby-forum.com/t/tip-to-compile-a-32bit-version-of-ruby-on-snow-leopard/183075>\
**Category:** Rails\
**Created:** [February 7, 2010, 4:22pm UTC](https://www.ruby-forum.com/t/tip-to-compile-a-32bit-version-of-ruby-on-snow-leopard/183075 "2010-02-07T16:22:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![PierreW](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/da6949/32.png) [@PierreW](https://www.ruby-forum.com/u/PierreW)\
**Post date:** [February 7, 2010, 4:22pm UTC](https://www.ruby-forum.com/t/tip-to-compile-a-32bit-version-of-ruby-on-snow-leopard/183075/1 "2010-02-07T16:22:33Z")

</div>

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
