[PyKDE] Building SIP + PyQt on Mac OS X
Dimitri Papadopoulos
papadopo at .shfj.cea.DECOY.fr
Fri Apr 19 13:14:21 BST 2002
Hi,
For those interested, this describes how to build SIP+PyQt on
Mac OS X using the following:
Mac OS X 10.1.3
I understand 10.1 is suggested by Trolltech:
http://www.trolltech.com/developer/platforms/osx.html
SIP 3.2rc1
http://www.riverbankcomputing.co.uk/download/snapshots/sip-3.2rc1.tar.gz
Note that SIP 3.1 has a minor bug that results in a linker
error, this bug is fixed in SIP 3.2rc1.
PyQt 3.2rc1 for Mac OS X
http://www.riverbankcomputing.co.uk/download/snapshots/PyQt-3.2rc1-Qt-3.0.2-MacX.tar.gz
Note that PyQt 3.1 does not disable some X11-only functions,
PyQt 3.2rc1 does so I suggest you use it.
Qt/Mac evaluation version
http://www.trolltech.com/products/qt/evaluate.html
Python for Mac OS X
http://fink.sourceforge.net/pdb/package.php/python
There are two versions of Python for Mac OS X:
* the above Python for Mac OS X which can be run
from the command line
* the traditional MacPython that knows nothing of
command lines and UNIX
Because MacPython cannot be called from the command
line and I couldn't even identify a Python executable,
and because PyQt requires the Python executable to be
indetified using the --with-python=FILE option, we
were not able to configure PyQt with MacPython.
I suggest you use Python for Mac OS X from Fink instead.
See also paragraph "MacOS X command-line interpreter"
on this page:
http://www.cwi.nl/~jack/macpython.html
Now, supposing you have Python for Mac OS X and Qt/Mac already
installed:
1) Building SIP:
Mac OS makes a distinction between modules and shared
libraries:
http://fink.sourceforge.net/doc/porting/shared.php
In short:
* shared libraries are named libfoo.dylib, while modules
can be named whatever (like on most systems) and are
usually named libfoo.so in software ported from UNIX.
* shared libraries are linked using the compiler option
-dynamiclib
while modules ("bundles" in Mac OS terminology) are
linker using the compiler option
-bundle
So we had to change manually the linking command line from:
c++ -dynamiclib -flat_namespace [...] -install_name
/sw/lib/python2.2/site-packages/libsip.9.dylib
-compatibility_version 10 -current_version 10
to:
c++ -bundle -flat_namespace [...] -install_name
/sw/lib/python2.2/site-packages/libsip.9.dylib
-compatibility_version 10 -current_version 10.0
Either manually modify the libtool script in the root
directory, or run the above command line manually.
Then the resulting module is named libsip.dylib, but Python
expects its modules to be named lib<module>.so, so either
symlink libsip.dylib to libsip.so or copy or move it.
2) Building PyQt:
This is pretty straightforward. There is one single problem.
The following functions are declared in the Qt headers but
are missing from the Qt library libqt-mt.dylib:
QFont::dirty()
QClipboard::ownsClipboard()
QClipboard::ownsSelection()
qAppName()
This will result in linker errors. You'll have to comment out
these functions in the respective qt/sipqtQ<class>.cpp file.
That's it.
Dimitri
More information about the PyQt
mailing list