Problems building things on MacOSX 10.5?
When trying to compile some library extensions to Ruby I got caught by the fact Apple today normally compile and link things for both PPC and i386 architecture. The calls to gcc normally have two -arch arguments like this:
cc -arch ppc -arch i386
This will not fly if you are later trying to link with libraries that for example is only i386 architecture. You get an error similar to this:
ld: warning in /usr/...../nnnn.dylib, file is not of required architecture
Undefined symbols for architecture ppc:
:
ld: symbol(s) not found for architecture ppc
If you look at the Apple Developer Connection article about Creating Universal Extensions for Perl, Python and Ruby you will see some information about the tricky pieces for both 10.4 and 10.5 (different mechanism of course). The good thing is that the solution is very simple for MacOSX 10.5 and later. Just set an environment variable, and you are fine. Example (I think really setting the environment variable is easier than as is suggested in the apple document, to use env, and specifically I think env+sudo messes things up).
# export ARCHFLAGS='-arch i386'