[PyQt] PyQt on OSX Snow Leopard notes

William Kyngesburye woklist at kyngchaos.com
Fri Sep 4 15:13:08 BST 2009

For those trying this, here's what I found so far:

- gcc compiles 64bit by default now, which will cause problems with  
the 32bit-only Qt (unless you are using Qt Cocoa).  Configure SIP  
universal so you get a 32bit SIP (the extra PPC code is harmless,  
except that PyQt will take longer to compile and be larger than  
necessary).  If you want 32bit-only or 32+64bit intel, you need to  
edit siputils.py and change the unicflags and unilflags lines  

- the macx-g++ Qt mkspec is meant to run the current gcc version,  
which is now 4.2.  But there is also a specifically macx-g++42  
mkspec.  I figured macx-g++ should agree more with Qt, which was built  
with gcc 4.0, so I edited it to run 4.0.  I don't know if it's really  
a problem anywhere down the line.  Maybe there should be a macx-g++40  
now.  But I don't know how to select a mkspec in the PyQt  
configuration (I haven't looked).

- the python 2.6 executable is 32+64bit now, and will run 64bit by  
default. This is a problem with pyuic4, which is a shell script which  
runs a python script (with pythonw).  At first I thought to use the  
arch command in pyuic4 shell script to run pythonw in 32bit mode, but  
apparently the arch command is broken and pythonw would still run  
64bit.  So I ended up creating a stripped copy of pythonw in /usr/ 
local/bin with ditto:

sudo ditto -arch i386 /usr/bin/pythonw2.6 /usr/local/bin/pythonw32

and running that from the pyuic4 script.  If any of your PyQt-based  
applications run from python, they'll have to use this also.  Unless,  
of course, you use Qt Cocoa and compile PyQt 64bits.

William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>

Theory of the Universe

There is a theory which states that if ever anyone discovers exactly  
what the universe is for and why it is here, it will instantly  
disappear and be replaced by something even more bizarrely  
inexplicable.  There is another theory which states that this has  
already happened.

-Hitchhiker's Guide to the Galaxy 2nd season intro

More information about the PyQt mailing list