[PyQt] Symbol not found: _sipQtConnect (Qt5 and PyQt 4.10 on OSX, 32 bit)

Phil Thompson phil at riverbankcomputing.com
Sat Mar 16 08:56:04 GMT 2013


On Sat, 16 Mar 2013 14:16:08 +1300, Glenn Ramsey <gr at componic.co.nz>
wrote:
> On 15/03/13 22:07, Phil Thompson wrote:
>> On Fri, 15 Mar 2013 15:51:00 +1300, Glenn Ramsey <gr at componic.co.nz>
>> wrote:
>>> Hi,
>>>
>>> I have built a 32 bit version of PyQt on OSX (10.8.2) using Qt5, but
it
>>> doesn't
>>> work:
>>>
>>> Python 2.7.3 (default, Feb 26 2013, 11:03:37)
>>> [GCC 4.2.1 Compatible Apple Clang 4.0 ((tags/Apple/clang-421.0.60))]
on
>>> darwin
>>> Type "help", "copyright", "credits" or "license" for more information.
>>>>>> import PyQt4.QtCore
>>> Traceback (most recent call last):
>>>     File "<stdin>", line 1, in <module>
>>> ImportError:
>>>
>>
dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyQt4/QtCore.so,
>>> 2): Symbol not found: _sipQtConnect
>>>     Referenced from:
>>>
>>
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyQt4/QtCore.so
>>>     Expected in: flat namespace
>>>    in
>>>
>>
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyQt4/QtCore.so
>>>
>>> Is there a workaround for this issue?
>>>
>>> My setup:
>>>
>>> I'm using the git version of qt5 (5.0.x), because there is a bug in
>> 5.0.1
>>> that
>>> prevents 32 bit builds on OSX, with the following config.
>>> ./configure -platform macx-clang-32 -nomake docs -nomake examples
>> -nomake
>>> demos
>>> -nomake tests  -nomake webkit -opensource -confirm-license -release
>>> -no-c++11
>>>
>>> sip 4.14.4
>>> python configure.py --arch i386
>>>
>>> PyQt 4.10 (commercial)
>>> python configure.py --use-arch i386
>>>
>>> I had to change qt_macx_spec in configure.py to get it work:
>>> #qt_macx_spec = 'macx-g++'
>>> qt_macx_spec = 'macx-clang-32'
>>>
>>> The python version is 2.7 from MacPorts, built as 32 bit.
>>>
>>> I have also rebuilt both sip and PyQt4 after doing a "make clean".
>>>
>>> Glenn
>>
>> You are doing a few things which, at best, are untested.
>>
>> Can you "import sip"?
> 
> yes, that works fine:
> 
> Python 2.7.3 (default, Feb 26 2013, 11:03:37)
> [GCC 4.2.1 Compatible Apple Clang 4.0 ((tags/Apple/clang-421.0.60))] on
> darwin
> Type "help", "copyright", "credits" or "license" for more information.
>  >>> import sip
>  >>> dir(sip)
> ['SIP_VERSION', 'SIP_VERSION_STR', '_C_API', '__doc__', '__file__',
> '__name__', 
> '__package__', '_unpickle_enum', '_unpickle_type', 'cast', 'delete',
> 'dump', 
> 'getapi', 'isdeleted', 'ispycreated', 'ispyowned', 'setapi',
'setdeleted', 
> 'setdestroyonexit', 'settracemask', 'simplewrapper', 'transferback', 
> 'transferto', 'unwrapinstance', 'voidptr', 'wrapinstance', 'wrapper',
> 'wrappertype']
>  >>> print sip.SIP_VERSION_STR
> 4.14.4
> 
>>
>> There may be an issue building sip with macx-g++ and PyQt with
>> macx-clang-32.
> 
> Even though the spec is macx-g++ sip actually builds using the system cc
> and 
> c++, which are symlinks to clang and clang++ so they are both being
built
> by the 
> clang compiler.
> 
> sip-4.14.4$ python configure.py --arch=i386
> This is SIP 4.14.4 for Python 2.7.3 on darwin.
> The SIP code generator will be installed in
> /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin.
> The sip module will be installed in
>
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages.
> The sip.h header file will be installed in
>
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7.
> The default directory to install .sip files in is
> /opt/local/Library/Frameworks/Python.framework/Versions/2.7/share/sip.
> The platform/compiler configuration is macx-g++.
> MacOS/X binaries will be created for i386.
> Creating siplib/sip.h...
> Creating siplib/siplib.c...
> Creating siplib/siplib.sbf...
> Creating sipconfig.py...
> Creating top level Makefile...
> Creating sip code generator Makefile...
> Creating sip module Makefile...
> sip-4.14.4$ make
> cc -c -pipe -arch i386 -Os -w -DNDEBUG -I. -o main.o main.c
> cc -c -pipe -arch i386 -Os -w -DNDEBUG -I. -o transform.o transform.c
> cc -c -pipe -arch i386 -Os -w -DNDEBUG -I. -o gencode.o gencode.c
> cc -c -pipe -arch i386 -Os -w -DNDEBUG -I. -o extracts.o extracts.c
> cc -c -pipe -arch i386 -Os -w -DNDEBUG -I. -o export.o export.c
> cc -c -pipe -arch i386 -Os -w -DNDEBUG -I. -o heap.o heap.c
> cc -c -pipe -arch i386 -Os -w -DNDEBUG -I. -o parser.o parser.c
> cc -c -pipe -arch i386 -Os -w -DNDEBUG -I. -o lexer.o lexer.c
> c++ -headerpad_max_install_names -arch i386 -o sip main.o transform.o
> gencode.o 
> extracts.o export.o heap.o parser.o lexer.o
> cc -c -pipe -fPIC -arch i386 -Os -w -DNDEBUG -I. 
>
-I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
> 
> -o siplib.o siplib.c
> cc -c -pipe -fPIC -arch i386 -Os -w -DNDEBUG -I. 
>
-I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
> 
> -o apiversions.o apiversions.c
> cc -c -pipe -fPIC -arch i386 -Os -w -DNDEBUG -I. 
>
-I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
> 
> -o descriptors.o descriptors.c
> cc -c -pipe -fPIC -arch i386 -Os -w -DNDEBUG -I. 
>
-I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
> 
> -o qtlib.o qtlib.c
> cc -c -pipe -fPIC -arch i386 -Os -w -DNDEBUG -I. 
>
-I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
> 
> -o threads.o threads.c
> cc -c -pipe -fPIC -arch i386 -Os -w -DNDEBUG -I. 
>
-I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
> 
> -o objmap.o objmap.c
> cc -c -pipe -fPIC -arch i386 -Os -w -DNDEBUG -I. 
>
-I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
> 
> -o voidptr.o voidptr.c
> c++ -c -pipe -fPIC -arch i386 -Os -w -DNDEBUG -I. 
>
-I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
> 
> -o bool.o bool.cpp
> c++ -headerpad_max_install_names -bundle -undefined dynamic_lookup -arch
> i386 -o 
> sip.so siplib.o apiversions.o descriptors.o qtlib.o threads.o objmap.o
> voidptr.o 
> bool.o
> 
>>  From previous experience I don't trust MacPorts stuff.
> 
> It was all working fine with Qt 4.8.4/PyQt4.9.5, but there is an issue
> with 
> 4.8.4 on OSX 10.6 that prompted us attempt to move to Qt 5.
> 
> What alternatives do I have given that I need a 32 bit build (due to
some
> 3rd 
> party code that isn't yet 64 bit compatible)?

First off I think your SIP build is fine and we can discount that. The
problem is your PyQt build.

The odd thing is that sipQtConnect is implemented as part of PyQt
(specifically in qpy/QtCore/qpycore_sip_helpers.cpp) so it's difficult to
see how it could be missing. Two things to check...

Make sure you are compiling from a clean source package. The current build
system isn't great at handling dependencies - for example if you make a
change to a qpy source file it probably won't be picked up by the build
system.

Make sure the qpy libraries are being built as you expect (ie. 32 bits
rather than 64), ie. that your change to macx-clang-32 is being applied to
everything.

Phil


More information about the PyQt mailing list