[PyKDE] Building SIP + PyQt [3.2rc2] on Mac OS X

Dimitri Papadopoulos papadopo at remove.shfj.decoy.cea.fr
Mon Apr 22 14:08:00 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

December 2001 Mac OS X Developer Tools

SIP 3.2rc2
	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.
	SIP 3.2rc1 fixes that issue, I suggest you use SIP 3.2rc2.

PyQt 3.2rc2 for Mac OS X
	http://www.riverbankcomputing.co.uk/download/snapshots/PyQt-3.2rc2-Qt-3.0.2-MacX.tar.gz
	Note that PyQt 3.1 does not disable some X11-only functions
	and has some problems with casting "unsigned long" to "void*",
	and that PyQt 3.2rc1 calls other functions declared in the
	Qt headers but no implemented in the Qt/Mac library.
	PyQt 3.2rc2 fixes all these issues, 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.
	See also paragraph "MacOS X command-line interpreter"
	on this page:
	http://www.cwi.nl/~jack/macpython.html
	I suggest you use Python for Mac OS X from Fink.


Provided you're using SIP 3.2rc2 and PyQt 3.2rc2, SIP and PyQt
should build out of the box on Mac OS X, with the exception of:

1) You'll see warnings of the kind described in 
   	http://mats.gmd.de/pipermail/pykde/2002-April/002540.html
   	http://mats.gmd.de/pipermail/pykde/2002-April/002555.html
   and end with:
   	cpp-precomp: warning: errors during smart preprocessing,
  	retrying in basic mode
   These warnings can be safely ignored. They're the result of
   a harmless compiler bug:
   	http://www.wxwindows.org/faqmac.htm#smarterrors

2) 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) should
     be linked using the compiler option
     	-bundle

   We had to change manually the linking command line for SIP
   and PyQt. In SIP for example, we had to change 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. You'll
   have to repeat this step for each and every module in PyQt...

Dimitri




More information about the PyQt mailing list