Compiling as 32bit on MacOSX
Philip Semanchuk
philip at semanchuk.com
Wed Oct 13 09:03:38 EDT 2010
On Oct 13, 2010, at 3:54 AM, Gregory Ewing wrote:
> Philip Semanchuk wrote:
>
>> Hi Greg,
>> Are you talking about compiling Python itself or extensions?
>
> I've managed to get Python itself compiled as 32 bit,
> and that also seems to take care of extensions built
> using 'python setup.py ...'.
>
> I'm mainly concerned about non-Python libraries that
> get wrapped by the extensions, of which I've built up
> quite a collection over the years. Currently I'm having
> to keep a careful eye out when building them to make
> sure they don't get compiled with the wrong architecture,
> since gcc's natural inclination is to default to 64 bit
> whenever it's available.
>
> So I was wondering if there was some way of globally
> changing that default that doesn't rely on compiler
> options getting passed correctly through the many and
> varied layers of build technology that one comes across.
> But from what I've seen so far, it seems not.
If CFLAGS isn't doing the trick for you, then I don't know what to suggest. Maybe some libs also need LDFLAGS='-arch i386 -arch x86_64'?
FYI, the `file` command will give you information about whether or not a binary is 32-bit, 64-bit or both.
$ file shlib/libreadline.6.1.dylib
shlib/libreadline.6.1.dylib: Mach-O universal binary with 2 architectures
shlib/libreadline.6.1.dylib (for architecture i386): Mach-O dynamically linked shared library i386
shlib/libreadline.6.1.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
Good luck
Philip
More information about the Python-list
mailing list