[PyQt] Compiling PyQt on Mac OS X

Daniel Miller daniel at keystonewood.com
Thu Aug 21 19:09:25 BST 2008


>> ... In general, Qt 4 on Mac does not look as polished and  
>> professional as Qt 3.3 does, which is very surprising to me since  
>> it was supposed to be so much better.
>
> Are you sure about this?
>
> If you look at the custom sort/filter demo on Qt 4.4.1, the column  
> header turns blue and shows the sort arrow when sorting is chosen.
>
> I think Qt 4.4 is the best Mac version ever. It gets nearly all the  
> small details right. You can do unified toolbars, it displays Mac  
> icons natively and correctly in directory views, and so on.

Thanks for letting me know about this. I wasn't able to find any  
screen shots of apps using Qt 4.4.1 so I assumed it was still the  
same as 4.3. I'll definitely give this a try.

>>>> I didn't have a problem building Qt or SIP, the only problem I  
>>>> had was with PyQt. The errors I had were rather strange--looked  
>>>> like something was wrong with SIP. Unfortunately I was not able  
>>>> to find any older versions of SIP to try them out (i.e. versions  
>>>> 4.5 or 4.6). Have you successfully (on Mac OS) built PyQt 4.4.3 ?
>>> Yes, that's what I'm using now.
>> One further qualification, what version of SIP are you using? I'm  
>> sorry for being so naggy here, but I'd like to figure out why I'm  
>> getting these errors. Do you know, did something change in PyQt  
>> recently that makes it only work with a framework build of Qt? I  
>> was able to successfully compile and use the following library  
>> versions:
>> Qt 4.3.2
>> SIP 4.7.1
>> PyQt 4.3.1
>> And I compiled those using the exact same options and procedure I  
>> was using when I ran into problems with PyQt 4.4.3
>>
>
> I'm using Qt 4.41, sip  4.7.7, and PyQt 4.4.3.

Well, I feel a little sheepish... I had a borked install of sip  
installed with python, which was causing the errors. I was also  
configuring against Qt 4.3.2 by mistake (should have caught that one  
for sure). Anyway, it's working now. I was able to do a full compile  
without problems. For anyone who's interested, here's the commands I  
used:

$ cd qt-mac-opensource-src-4.4.1
$ ./configure -nomake examples -nomake demos -no-qdbus -universal -no- 
framework \
   -no-exceptions -prefix /Developer/Qt/Qt_4.4.1/qt-mac-opensource- 
src-4.4.1/build
$ make
$ make install

$ cd ../sip-4.7.7
$ python configure.py -n -s MacOSX10.4u.sdk \
   -b /Developer/Qt/Qt_4.4.1/sip-4.7.7/build/bin \
   -e /Developer/Qt/Qt_4.4.1/sip-4.7.7/build/include \
   -d /Developer/Qt/Qt_4.4.1/sip-4.7.7/build/lib \
   -v /Developer/Qt/Qt_4.4.1/sip-4.7.7/build/sipfiles
$ make
$ make install
$ export PYTHONPATH=/Developer/Qt/Qt_4.4.1/sip-4.7.7/build/lib

$ cd ../PyQt-mac-gpl-4.4.3
$ python configure.py -e QtCore -e QtGui --confirm-license \
   -q /Developer/Qt/Qt_4.4.1/qt-mac-opensource-src-4.4.1/bin/qmake \
   -b /Developer/Qt/Qt_4.4.1/PyQt-mac-gpl-4.4.3/build/bin \
   -d /Developer/Qt/Qt_4.4.1/PyQt-mac-gpl-4.4.3/build/lib
$ make
$ make install

I've configured these to install in a 'build' directory within each  
source directory. This allows me to install without using sudo, which  
is nice. I think this setup is a little cleaner than the default as  
it allows me to experiment with different versions of Qt/PyQt more  
easily without messing up the global state of my system.

Thanks a lot for the help Kevin.

~ Daniel



More information about the PyQt mailing list