[PyQt] PyQt 4.6 (64b) on Snow Leopard & the Symbol not found:
_sipQtConnect - A longish tale
Pierre Gerard-Marchant
pierregmcode at gmail.com
Mon Sep 28 18:23:26 BST 2009
All,
I spent the last couple of weeks running into the same issue with PyQt
on Snow Leopard (10.6.1): compilation and installation ran without
problems, but when I tried to import PyQt, I got the following message:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: dlopen(/Users/pierregm/.local/lib/python2.6/site-packages/
PyQt4/QtCore.so, 2): Symbol not found: _sipQtConnect
Referenced from: /Users/pierregm/.local/lib/python2.6/site-packages/
PyQt4/QtCore.so
Expected in: flat namespace
in /Users/pierregm/.local/lib/python2.6/site-packages/PyQt4/QtCore.so
I'm using i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build
5646) and Python 2.6.1 (the Apple one, 64b). Because I'm using a 64b
Python, I wanted to Qt to run both in 32b and 64b mode. I tried
different Qt4 (the official 4.5.2 binaries, the official 4.5.2
sources) before settling on their latest 4.5 git branch (that's a
pre-4.5.3). These sources compiled fine with the following arguments
for ./configure:
./configure --prefix=${PREFIX} \
-release -opensource -shared -confirm-license \
-nomake examples -nomake demos -no-qt3support \
-cocoa -framework -arch x86 -arch x86_64 -platform macx-g+
+42 \
-I/usr/X11R6/include -L/usr/X11R6/lib -I/usr/local/include \
-verbose
When I double-check my installation, Qt seems to work with both the
i386 and x86_64 versions:
lipo -info /usr/local/Cellar/qt/4.5.2/lib/QtCore.framework/Versions/
4/QtCore
Architectures in the fat file: /usr/local/Cellar/qt/4.5.2/lib/
QtCore.framework/Versions/4/QtCore are: x86_64 i386
I tried 20090919 snapshots of SIP and PyQt, then the latest sources
(4.9 and 4.6 resp.), to no avail alas, _sipQtConnect was not to be
found. The corresponding configuration arguments were:
SIP : --arch=i386 --arch=x86_64 \
--bindir=${BINDIR} \
--destdir=${DESTDIR} \
--incdir=${INCDIR} \
--sipdir=${SIPDIR}
PyQt : --bindir=${BINDIR} \
--destdir=${DESTDIR} \
--confirm-license \
--qsci-api \
--use-arch=i386 --use-arch=x86_64 --verbose
A thread from 6 months ago (http://www.mail-archive.com/pyqt@riverbankcomputing.com/msg16969.html
) gave me the idea to double-check the content of `configure.py` in
PyQt-mac-gpl-4.6. In the `arch_config` function,I modified lines 908
and 909 from
>>>if a in ('i386', 'x86_64'):
>>> qmake_archs.append('x86')
to
>>>if a in ('i386', 'x86_64'):
>>> qmake_archs.append('x86_64')
reran python configure.py (with the same args), recompiled and bingo,
PyQt4.QtCore can now be imported (and now I can use the Qt4Agg backend
for matplotlib).
So, OK, it works, fine. But I still wonder what happened. Did I find a
bug ? Did I miss something ? Section 3.4 of the PyQt4 reference tells
that by default Qt is 32b, so PyQt4 should be compiled as 32b. But in
my case, Qt supports both, so I should be able to compile for the 2
arches, right ?
Looking forward to reading your comments
Cheers
P.
More information about the PyQt
mailing list