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

Joe Strout joe at strout.net
Wed Jan 7 21:48:31 CET 2009


Daniel Miller wrote:

>> So: does anyone have a clue how I can convince setuptools to build a PPC
>> binary (or better yet, a Universal one) on an Intel machine?
> 
> I just downloaded the mysqldb module from sourceforge to have a look at 
> how it decides how to compile its C extension. It looks like it's 
> getting the CFLAGS and LFLAGS from mysql_config. You'll need a universal 
> binary of libmysqlclient (as Chris already pointed out).

OK, but to be clear, libmysqlclient isn't something from somewhere else 
that mysqldb uses -- it's the C extension of mysqldb itself, right? 
Something built when I do "python setup.py install" in the mysqldb 
source directory?

> At any rate, 
> you'll want to try to see what CFLAGS/LFLAGS were used to compile 
> libmysqlclient. You might try to run the following command in terminal:
> 
> $ mysql_config --cflags

-I/usr/local/mysql/include  -g -Os  -fno-common   -D_P1003_1B_VISIBLE 
-DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ 
-DIGNORE_SIGHUP_SIGQUIT  -DDONT_DECLARE_CXA_PURE_VIRTUAL

> Which may shed some light on the situation. You'll be looking for 
> something like this in the output:
> 
>  -arch ppc -arch i386

Hmm, I don't see those.  If this were a makefile situation, I'd have 
some idea where to start poking further to find (or specify) these 
flags.  With setuptools, I haven't a clue -- what's the next step?  Is 
this something I can hack into setup.py, or what?

> Which tells the compiler to include these architectures in the resulting 
> binary. As Chris already mentioned, you'll also need a universal 
> Python--I'm assuming you've already got that... 

Yes, I do seem to.  And I can make an app (with py2app) that works fine 
on PPC and Intel Macs, as long as it doesn't use mysql.  So this appears 
to be the last part of the puzzle.

Thanks,
- Joe



More information about the Pythonmac-SIG mailing list