[PyQt] Symbol not found in QtGui.so on Snow Leopard 10.6.3 64bit

William Kyngesburye woklist at kyngchaos.com
Wed May 19 23:34:37 BST 2010


On May 19, 2010, at 12:54 PM, Rob McPeak wrote:

> I'm getting the following error when trying to import PyQt4.QtGui using my freshly-built Qt, SIP and PyQt4.
> Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29) 
> [GCC 4.2.1 (Apple Inc. build 5646)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> from PyQt4.QtCore import *
> >>> from PyQt4.QtGui import *
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ImportError: dlopen(/Library/Python/2.6/site-packages/PyQt4/QtGui.so, 2): Symbol not found: __ZN13QPyTextObject16staticMetaObjectE
>   Referenced from: /Library/Python/2.6/site-packages/PyQt4/QtGui.so
>   Expected in: flat namespace
>  in /Library/Python/2.6/site-packages/PyQt4/QtGui.so
> 
> To build qt-everywhere-opensource-src-4.6.2 I did the following, since I'd like to get everything running in 64bit mode:
> ./configure -arch x86_64
> gmake
> sudo gmake install
> 
Even easier - use the premade installers, just make sure you install the Cocoa version to get 64bit binaries.  And this way, your Qt stuff should be found automatically (like qmake below in the PyQt configure).

> I built sip-4.10.2 this way:
> python configure.py
> make
> sudo make install
> 
First, I don't think SIP configures automatically for 64bit, and this would be the root cause of your error - no 64bit python modules built.  You should also make sure it uses the right SDK (though it might not matter).  "-n" is for universal, and is needed to trigger architecture handling on OS X.  So, something like:

python2.6 configure.py -n --arch=x86_64 -s MacOSX10.6.sdk

Add "--arch=i386" if you want a complete 32+64bit binary.

Also, it's not a good idea to let python decide on the install location.  By default, python modules and other bits will install inside the Python framework in the system.  Not a good idea, as Apple could zap it on a system update.  So, configure the paths:

python2.6 configure.py -n -d /Library/Python/2.6/site-packages -b /usr/local/bin -e /usr/local/include -v /usr/local/share/sip --arch=x86_64 -s MacOSX10.6.sdk


> I built PyQt-mac-gpl-4.7.3 this way:
> python configure.py -q /usr/local/Trolltech/Qt-4.6.2/bin/qmake
> make
> sudo make install
> 
Then, assuming the above SIP configuration, and the Qt installer binaries (configuring the paths like with SIP):

python2.6 configure.py -d /Library/Python/2.6/site-packages -b /usr/local/bin


-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

The equator is so long, it could encircle the earth completely once.



More information about the PyQt mailing list