[Pythonmac-SIG] How to get setuptools to build a Universal Binary?
Christopher Barker
Chris.Barker at noaa.gov
Thu Jan 8 01:48:24 CET 2009
Ned Deily wrote:
> No, MySQLdb does have a C extension component. There should be a
> _mysql.so there somewhere. If you build it with easy_install, the
> unzipped egg layout is:
and if you build it with plain old "setup.py build", you get a build dir
with:
ls build/lib.macosx-10.3-ppc-2.5/
MySQLdb _mysql.so _mysql_exceptions.py
I've just done it straight, with a PPC build of MySQL -- I got:
gcc -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g
-bundle -undefined dynamic_lookup
build/temp.macosx-10.3-ppc-2.5/_mysql.o -L/usr/local/mysql/lib
-lmysqlclient_r -lz -lm -lmygcc -o build/lib.macosx-10.3-ppc-2.5/_mysql.so
/usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: for architecture i386
/usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: warning
build/temp.macosx-10.3-ppc-2.5/_mysql.o cputype (18, architecture ppc)
does not match cputype (7) for specified -arch flag: i386 (file not loaded)
which I think makes sense, as _mysql.o was built with the flags from
mysql-config, which only gives PPC as it's now set on my machine.
However:
$ file build/lib.macosx-10.3-ppc-2.5/_mysql.so
build/lib.macosx-10.3-ppc-2.5/_mysql.so: Mach-O universal binary with 2
architectures
build/lib.macosx-10.3-ppc-2.5/_mysql.so (for architecture i386):
Mach-O bundle i386
build/lib.macosx-10.3-ppc-2.5/_mysql.so (for architecture ppc): Mach-O
bundle ppc
so I did get a universal _mysql.so, but I doubt it would work on a Intel
machine.
> and, with a fat python config:
>
> $ file _mysql.so
> _mysql.so: Mach-O universal binary with 2 architectures
> _mysql.so (for architecture i386): Mach-O bundle i386
> _mysql.so (for architecture ppc): Mach-O bundle ppc
Ned, how did you built that?
> $ file libmysqlclient_r.16.0.0.dylib
> libmysqlclient_r.16.0.0.dylib: Mach-O universal binary with 3
> architectures
> libmysqlclient_r.16.0.0.dylib (for architecture i386): Mach-O
> dynamically linked shared library i386
> libmysqlclient_r.16.0.0.dylib (for architecture ppc64): Mach-O 64-bit
> dynamically linked shared library ppc64
> libmysqlclient_r.16.0.0.dylib (for architecture ppc): Mach-O dynamically
> linked shared library ppc
and where did you get this? is that from the tarball on the MySQL site?
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
More information about the Pythonmac-SIG
mailing list