[Pythonmac-SIG] How to get setuptools to build a Universal Binary?

Joe Strout joe at strout.net
Thu Jan 8 05:53:45 CET 2009


Ned Deily wrote:

> Hmm, there's omething odd about that download. 
> ...

> $ 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

OK, I think I see your point here.  In the 5.1 download, 
libmysqlclient_r.16.0.0.dylib is universal, but 
libmysqlclient_r.16.dylib is not.  From the looks of the 5.0 download, 
these should be the same (both universal).

> Perhaps you can get away with making a symlink or copying from one to 
> the other??

Seems reasonable, so as a test, I copied libmysqlclient_r.16.0.0.dylib 
into my app bundle on top of libmysqlclient_r.16.dylib.  I verified with 
"file" that my libmysqlclient_r.16.dylib is now universal, and verified 
that my app still runs on an Intel Mac.  But on a PPC (10.4) Mac, it 
still fails:

   File 
"/Users/jstrout/Temp/etownCentral.app/Contents/Resources/IADB.py", line 
12, in <module>
     import MySQLdb
   File "MySQLdb/__init__.pyc", line 19, in <module>
ImportError: 
dlopen(/Users/jstrout/Temp/etownCentral.app/Contents/Resources/lib/python2.5/lib-dynload/_mysql.so, 
2): Symbol not found: _mysql_get_host_info
   Referenced from: 
/Users/jstrout/Temp/etownCentral.app/Contents/Resources/lib/python2.5/lib-dynload/_mysql.so
   Expected in: dynamic lookup

I used "otool -L" to check the dependencies of both _mysql.so and 
libmysqlclient_r.16.dylib.  All seemed satisfactory, though the one for 
the latter is a little strange:

$ otool -L libmysqlclient_r.16.dylib
libmysqlclient_r.16.dylib:
         /usr/local/mysql/lib/libmysqlclient_r.16.dylib (compatibility 
version 17.0.0, current version 17.0.0)
         /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, 
current version 88.1.11)

I'm not sure why libmysqlclient_r.16.dylib is listing a dependency on 
itself, but in /usr/local.  There is no /usr/local/mysql on a standard 
machine (including the one where this is failing).  Yet otool does list 
a "current version", perhaps because it's finding itself within the app 
bundle?  Seems a little odd.

The dependencies for mysql.so itself all look fine to me and refer only 
to three system files that really do exist.

So I'm stumped again... both libraries are now universal, yet for some 
reason, the _mysql_get_host_info symbol is not resolving.  Any idea what 
to try next?

Thanks,
- Joe




More information about the Pythonmac-SIG mailing list