[Pythonmac-SIG] How to get setuptools to build a Universal Binary?
Ned Deily
nad at acm.org
Thu Jan 8 01:12:42 CET 2009
In article <49653A6A.3070805 at strout.net>, Joe Strout <joe at strout.net>
wrote:
> Christopher Barker wrote:
>
> > the extensions that distutils builds will be called something like
> > _mysql. It will be in site_packages, and in your app bundle, along with
> > .py and .pyc files, NOT in with FrameWorks.
>
> Ah, I didn't know that. Poking around in Resources/lib (and including
> unzipping site-packages.zip), I find things like mySQL.pyc, and a
> MySQLdb folder containing a bunch of other .pyc files. Nothing else
> though; just Python bytecode. Is it possible that MySQLdb is written
> entirely in Python, and was never the problem at all? I.e., that given
> a suitable portable mysql client library, MySQLdb will Just Work?
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:
$ ls -l
total 224
drwxrwx--- 2 nad admin 272 Feb 23 2008 EGG-INFO
drwxrwx--- 3 nad admin 714 Feb 23 2008 MySQLdb
-rwxrwxr-x 1 nad admin 257 Feb 23 2008 _mysql.py
-rw-rw---- 1 nad admin 697 Feb 23 2008 _mysql.pyc
-rw-rw---- 1 nad admin 697 Feb 23 2008 _mysql.pyo
-rwxrwxr-x 1 nad admin 77964 Feb 23 2008 _mysql.so
-rwxrwxr-x 1 nad admin 2306 Feb 23 2008 _mysql_exceptions.py
-rw-rw---- 1 nad admin 5279 Feb 23 2008 _mysql_exceptions.pyc
-rw-rw---- 1 nad admin 5279 Feb 23 2008 _mysql_exceptions.pyo
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
> But OK, now this brings up the question of why my
> libmysqlclient_r.16.dylib is Intel-only, when I took pains to install a
> UB version of MySQL (c.f. the "Installing MySQL" section of
> <http://www.dotancohen.com/howto/python-app-mac.html>). (I'm going to
> do a fresh download of that mysql binary package and poke around inside
> to see what I find.)
Hmm, there's omething odd about that download.
-rw-r--r--@ 1 nad staff 4396 Nov 20 23:31 libdbug.a
-rw-r--r--@ 1 nad staff 2619952 Nov 20 23:31 libheap.a
-rw-r--r--@ 1 nad staff 7612800 Nov 20 23:31 libmyisam.a
-rw-r--r--@ 1 nad staff 3293744 Nov 20 23:31 libmyisammrg.a
-rwxr-xr-x@ 1 nad staff 15266468 Nov 20 23:32
libmysqlclient.16.0.0.dylib
-rwxr-xr-x@ 1 nad staff 4781040 Nov 15 14:57 libmysqlclient.16.dylib
-rw-r--r--@ 1 nad staff 17541992 Nov 20 23:31 libmysqlclient.a
-rwxr-xr-x@ 1 nad staff 4781040 Nov 15 14:57 libmysqlclient.dylib
-rwxr-xr-x@ 1 nad staff 867 Nov 15 14:57 libmysqlclient.la
-rwxr-xr-x@ 1 nad staff 15337152 Nov 20 23:32
libmysqlclient_r.16.0.0.dylib
-rwxr-xr-x@ 1 nad staff 4801460 Nov 15 14:57
libmysqlclient_r.16.dylib
-rw-r--r--@ 1 nad staff 17629744 Nov 20 23:31 libmysqlclient_r.a
-rwxr-xr-x@ 1 nad staff 4801460 Nov 15 14:57 libmysqlclient_r.dylib
-rwxr-xr-x@ 1 nad staff 881 Nov 15 14:57 libmysqlclient_r.la
-rw-r--r--@ 1 nad staff 203291168 Nov 20 23:31 libmysqld.a
-rw-r--r--@ 1 nad staff 5235560 Nov 20 23:31 libmystrings.a
-rw-r--r--@ 1 nad staff 2435784 Nov 20 23:31 libmysys.a
-rw-r--r--@ 1 nad staff 125656 Nov 20 23:30 libvio.a
-rw-r--r--@ 1 nad staff 563080 Nov 20 23:30 libz.a
-rwxr-xr-x@ 1 nad staff 741 Nov 15 14:57 libz.la
drwxr-xr-x@ 2 nad staff 408 Nov 20 23:32 plugin
$ 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
$ file libmysqlclient_r.16.dylib
libmysqlclient_r.16.dylib: Mach-O dynamically linked shared library i386
Perhaps you can get away with making a symlink or copying from one to
the other??
--
Ned Deily,
nad at acm.org
More information about the Pythonmac-SIG
mailing list