[PyQt] Static linking of PyQt and Qt

Markus Dahlbokum dahlbokum at intes.de
Wed Dec 12 13:18:13 GMT 2007


Hello,

I'm trying to build a custom python interpreter with pyqt and qt linked 
statically. Therefore I've built static libs for qt, sip and pyqt. With the 
custom interpreter builder in sip I succeeded to create such an all-in-one 
python but when I try to import the pyqt modules I get an error (see output 
below).
How can I solve this problem?

Markus

# installing zipimport hook
import zipimport # builtin
# installed zipimport hook
# /opt/python-2.4.4/lib/python2.4/site.pyc 
matches /opt/python-2.4.4/lib/python2.4/site.py
import site # precompiled from /opt/python-2.4.4/lib/python2.4/site.pyc
# /opt/python-2.4.4/lib/python2.4/os.pyc 
matches /opt/python-2.4.4/lib/python2.4/os.py
import os # precompiled from /opt/python-2.4.4/lib/python2.4/os.pyc
import posix # builtin
# /opt/python-2.4.4/lib/python2.4/posixpath.pyc 
matches /opt/python-2.4.4/lib/python2.4/posixpath.py
import posixpath # precompiled 
from /opt/python-2.4.4/lib/python2.4/posixpath.pyc
# /opt/python-2.4.4/lib/python2.4/stat.pyc 
matches /opt/python-2.4.4/lib/python2.4/stat.py
import stat # precompiled from /opt/python-2.4.4/lib/python2.4/stat.pyc
# /opt/python-2.4.4/lib/python2.4/UserDict.pyc 
matches /opt/python-2.4.4/lib/python2.4/UserDict.py
import UserDict # precompiled 
from /opt/python-2.4.4/lib/python2.4/UserDict.pyc
# /opt/python-2.4.4/lib/python2.4/copy_reg.pyc 
matches /opt/python-2.4.4/lib/python2.4/copy_reg.py
import copy_reg # precompiled 
from /opt/python-2.4.4/lib/python2.4/copy_reg.pyc
# /opt/python-2.4.4/lib/python2.4/types.pyc 
matches /opt/python-2.4.4/lib/python2.4/types.py
import types # precompiled from /opt/python-2.4.4/lib/python2.4/types.pyc
# /opt/python-2.4.4/lib/python2.4/warnings.pyc 
matches /opt/python-2.4.4/lib/python2.4/warnings.py
import warnings # precompiled 
from /opt/python-2.4.4/lib/python2.4/warnings.pyc
# /opt/python-2.4.4/lib/python2.4/linecache.pyc 
matches /opt/python-2.4.4/lib/python2.4/linecache.py
import linecache # precompiled 
from /opt/python-2.4.4/lib/python2.4/linecache.pyc
import encodings # directory /opt/python-2.4.4/lib/python2.4/encodings
# /opt/python-2.4.4/lib/python2.4/encodings/__init__.pyc 
matches /opt/python-2.4.4/lib/python2.4/encodings/__init__.py
import encodings # precompiled 
from /opt/python-2.4.4/lib/python2.4/encodings/__init__.pyc
# /opt/python-2.4.4/lib/python2.4/codecs.pyc 
matches /opt/python-2.4.4/lib/python2.4/codecs.py
import codecs # precompiled from /opt/python-2.4.4/lib/python2.4/codecs.pyc
import _codecs # builtin
# /opt/python-2.4.4/lib/python2.4/encodings/aliases.pyc 
matches /opt/python-2.4.4/lib/python2.4/encodings/aliases.py
import encodings.aliases # precompiled 
from /opt/python-2.4.4/lib/python2.4/encodings/aliases.pyc
# /opt/python-2.4.4/lib/python2.4/encodings/utf_8.pyc 
matches /opt/python-2.4.4/lib/python2.4/encodings/utf_8.py
import encodings.utf_8 # precompiled 
from /opt/python-2.4.4/lib/python2.4/encodings/utf_8.pyc
Python 2.4.4 (#1, Dec  7 2007, 11:16:51)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import QtCore
import QtCore # builtin
import sip # builtin
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
SystemError: _PyImport_FixupExtension: module QtCore not loaded
>>> import sys
>>> print sys.builtin_module_names
('QtCore', 'QtGui', '__builtin__', '__main__', '_codecs', '_sre', '_symtable', 'errno', 'exceptions', 'gc', 'imp', 'marshal', 'posix', 'pwd', 'signal', 'sip', 'sys', 'thread', 'time', 'xxsubtype', 'zipimport')
>>>
# clear __builtin__._
# clear sys.path
# clear sys.argv
# clear sys.ps1
# clear sys.ps2
# clear sys.exitfunc
# clear sys.exc_type
# clear sys.exc_value
# clear sys.exc_traceback
# clear sys.last_type
# clear sys.last_value
# clear sys.last_traceback
# clear sys.path_hooks
# clear sys.path_importer_cache
# clear sys.meta_path
# restore sys.stdin
# restore sys.stdout
# restore sys.stderr
# cleanup __main__
# cleanup[1] site
# cleanup[1] encodings
# cleanup[1] _codecs
# cleanup[1] zipimport
# cleanup[1] PyQt4.QtCore
# cleanup[1] warnings
# cleanup[1] encodings.utf_8
# cleanup[1] codecs
# cleanup[1] types
# cleanup[1] signal
# cleanup[1] linecache
# cleanup[1] posix
# cleanup[1] encodings.aliases
# cleanup[1] exceptions
# cleanup[2] copy_reg
# cleanup[2] sip
# cleanup[2] posixpath
# cleanup[2] os.path
# cleanup[2] stat
# cleanup[2] UserDict
# cleanup[2] os
# cleanup sys
# cleanup __builtin__
# cleanup ints: 7 unfreed ints in 1 out of 3 blocks
# cleanup floats




More information about the PyQt mailing list