[PyQt] Error in compiling the library

Hans-Peter Jansen hpj at urpla.net
Fri Sep 24 09:10:20 BST 2010


On Friday 24 September 2010, 06:41:48 Kannan U V wrote:
> H,
> I am trying to compile  PyQt and get the following error. I have
> python 2.4.3 and Qt 4.7.0 on a CentOS 5.5
>
> make[1]: Leaving directory
> `/home/kannanuv/software/PyQt-x11-gpl-4.7.7/pylupdate'
> make[1]: Entering directory
> `/home/kannanuv/software/PyQt-x11-gpl-4.7.7/pyrcc' g++ -c -m64 -pipe -O2
> -Wall -W -D_REENTRANT -DNDEBUG -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_XML_LIB
> -I.
> -I/usr/local/Trolltech/Qt-4.7.0/mkspecs/default
> -I/usr/local/Trolltech/Qt-4.7.0/include/QtCore
> -I/usr/local/Trolltech/Qt-4.7.0/include/QtXml
> -I/usr/local/Trolltech/Qt-4.7.0/include -o main.o main.cpp
> g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -DNDEBUG -DQT_NO_DEBUG
> -DQT_CORE_LIB -DQT_XML_LIB -I.
> -I/usr/local/Trolltech/Qt-4.7.0/mkspecs/default
> -I/usr/local/Trolltech/Qt-4.7.0/include/QtCore
> -I/usr/local/Trolltech/Qt-4.7.0/include/QtXml
> -I/usr/local/Trolltech/Qt-4.7.0/include -o rcc.o rcc.cpp
> g++ -Wl,-O1 -o pyrcc4 main.o rcc.o -L/usr/local/Trolltech/Qt-4.7.0/lib
> -lQtCore -L/usr/local/Trolltech/Qt-4.7.0/lib -lpthread -lQtXml
> -L/usr/local/Trolltech/Qt-4.7.0/lib -lQtCore
> -L/usr/local/Trolltech/Qt-4.7.0/lib -lpthread -lpthread
> ./pyrcc4 -py2 -o
> ../examples/draganddrop/fridgemagnets/fridgemagnets_rc.py
> ../examples/draganddrop/fridgemagnets/fridgemagnets.qrc
> ./pyrcc4: symbol lookup error: ./pyrcc4: undefined symbol:
> _Z7qstrcmpRK10QByteArrayPKc
> make[1]: *** [pyrcc4] Error 127
> make[1]: Leaving directory
> `/home/kannanuv/software/PyQt-x11-gpl-4.7.7/pyrcc' make: *** [all] Error
> 2

It looks like your local Qt installation is broken. 

Check this:
$ ldd /home/kannanuv/software/PyQt-x11-gpl-4.7.7/pyrcc/pyrcc4

All Qt related libs must point into /usr/local/Trolltech/Qt-4.7.0/lib

Next try to compile a Qt example in your local Qt installation with the 
usual qmake && make, and check, that it does not interfear with a system Qt 
installation.

Even better, get rid of the local Qt build, including the parts that spread 
into system dirs, and rebuild the CentOS Qt rpm with the actual Qt version, 
replacing the official one.

Doing so for sip and PyQt4 also results in a nicely reproducible and 
transferable Qt and PyQt environment. It's always worth the effort.

Note that replacing the system Qt with a new rpm is pretty risk free:
 - the original package(s) can be restored easily
 - the Qt architects do a good job on providing binary backwards
   compatibility (unlike many competitors)

Pete


More information about the PyQt mailing list