[PyKDE] Building PyQt as 1 shared library

Ulrich Berning ulrich.berning at desys.de
Fri Nov 7 09:52:01 GMT 2003


Peter Kropf schrieb:

> To start, merging qttable into qt was fairly easy. I modified 
> qtmod.sip, adding %Include qtable.sip. Then rebuilding PyQt resulted 
> in the qtable code being included and accessable from python. Instead of:
>
>     from qttable import QTable
>
> the python code now reads:
>
>     from qt import QTable
>
> As to why I want to do this, it has to do with deployment issues on 
> Solaris. (See my posting from yesterday titled "qttable and installer 
> confusion on windows and solaris" for details.) We're using Gordon 
> McMillan's Installer (which is a great tool) to create executables for 
> distribution. All is well when running in the development environment 
> (Windows and Solaris) and in the Windows distribution. But on Solaris 
> we have runtime issues. I've been able to trace the problem back to 
> the fact that qt and qtable are two seperate shared libraries. Why 
> that matters, I don't know yet and it's very frustrating. However by 
> building qtable into the qt shared library, I'm able to create a 
> distribution package on Solaris that works.
>
> - Peter
>
If everything works in the development environment, than Gordon 
McMillan's installer is the problem, not SIP/PyQt. I have tried your 
sample code on a Linux system. My SIP/PyQt installation in site-packages 
looks like this:

libqtcanvascmodule.so -> libqtcanvascmodule.so.1.0.0
libqtcanvascmodule.so.1 -> libqtcanvascmodule.so.1.0.0
libqtcanvascmodule.so.1.0 -> libqtcanvascmodule.so.1.0.0
libqtcanvascmodule.so.1.0.0
libqtcmodule.so -> libqtcmodule.so.1.0.0
libqtcmodule.so.1 -> libqtcmodule.so.1.0.0
libqtcmodule.so.1.0 -> libqtcmodule.so.1.0.0
libqtcmodule.so.1.0.0
libqtextcmodule.so -> libqtextcmodule.so.1.0.0
libqtextcmodule.so.1 -> libqtextcmodule.so.1.0.0
libqtextcmodule.so.1.0 -> libqtextcmodule.so.1.0.0
libqtextcmodule.so.1.0.0
libqtglcmodule.so -> libqtglcmodule.so.1.0.0
libqtglcmodule.so.1 -> libqtglcmodule.so.1.0.0
libqtglcmodule.so.1.0 -> libqtglcmodule.so.1.0.0
libqtglcmodule.so.1.0.0
libqtnetworkcmodule.so -> libqtnetworkcmodule.so.1.0.0
libqtnetworkcmodule.so.1 -> libqtnetworkcmodule.so.1.0.0
libqtnetworkcmodule.so.1.0 -> libqtnetworkcmodule.so.1.0.0
libqtnetworkcmodule.so.1.0.0
libqtsqlcmodule.so -> libqtsqlcmodule.so.1.0.0
libqtsqlcmodule.so.1 -> libqtsqlcmodule.so.1.0.0
libqtsqlcmodule.so.1.0 -> libqtsqlcmodule.so.1.0.0
libqtsqlcmodule.so.1.0.0
libqttablecmodule.so -> libqttablecmodule.so.1.0.0
libqttablecmodule.so.1 -> libqttablecmodule.so.1.0.0
libqttablecmodule.so.1.0 -> libqttablecmodule.so.1.0.0
libqttablecmodule.so.1.0.0
libqtuicmodule.so -> libqtuicmodule.so.1.0.0
libqtuicmodule.so.1 -> libqtuicmodule.so.1.0.0
libqtuicmodule.so.1.0 -> libqtuicmodule.so.1.0.0
libqtuicmodule.so.1.0.0
libqtxmlcmodule.so -> libqtxmlcmodule.so.1.0.0
libqtxmlcmodule.so.1 -> libqtxmlcmodule.so.1.0.0
libqtxmlcmodule.so.1.0 -> libqtxmlcmodule.so.1.0.0
libqtxmlcmodule.so.1.0.0
libsip.so -> libsip.so.11.0.0
libsip.so.11 -> libsip.so.11.0.0
libsip.so.11.0 -> libsip.so.11.0.0
libsip.so.11.0.0
qt.py
qt.pyc
qtcanvas.py
qtcanvas.pyc
qtext.py
qtext.pyc
qtgl.py
qtgl.pyc
qtnetwork.py
qtnetwork.pyc
qtsql.py
qtsql.pyc
qttable.py
qttable.pyc
qtui.py
qtui.pyc
qtxml.py
qtxml.pyc

As you can see, there are a lot of symbolic links. If I do a 'ldd 
libqttablecmodule.so' it shows me that it references libqtcmodule.so.1 
and not libqtcmodule.so. But all this works because there are symbolic 
links.

After running the installer with your spec file, the distmytable 
directory looks like this:

array.so
libICE.so.6
libSM.so.6
libX11.so.6
libXcursor.so.1
libXext.so.6
libXmu.so.6
libXrandr.so.2
libXrender.so.1
libXt.so.6
libqt-mt.so.3
libqtc.so
libqtcmodule.so.1
libqttablec.so
libsip.so
libsip.so.11
mytable
pwd.so
strop.so
struct.so
zlib.so

As you can see, there are no symbolic links any longer. The installer 
has duplicated the code of libqtcmodule.so in libqtc.so and 
libqtcmodule.so.1, because the installer resolves the inter-module 
dependencies, but it does not recognize that there are symbolic links. 
This is the reason why you have problems, because the code of 
libqtcmodule.so is loaded twice.

To make it work, you have a number of options:

1.) Change Gordon McMillan's installer, so that it creates symbolic 
links instead of duplicating the code.
2.) Use SIP V4, because there are no longer inter-module dependencies.
3.) After creating a distribution, remove the duplicated code and create 
symbolic links instead.

If your distmytable directory looks like this, everything should work:

array.so
libICE.so.6
libSM.so.6
libX11.so.6
libXcursor.so.1
libXext.so.6
libXmu.so.6
libXrandr.so.2
libXrender.so.1
libXt.so.6
libqt-mt.so.3
libqtc.so -> libqtcmodule.so.1
libqttablec.so
libsip.so -> libsip.so.11
mytable
pwd.so
strop.so
struct.so
zlib.so


I hope, I could help you
Ulli













More information about the PyQt mailing list