PySide Bugzilla Closed for New Bugs

PySide is now a Qt Add-on and uses the Qt Project's JIRA Bug Tracker instead of this Bugzilla instance. This Bugzilla is left for reference purposes.

Bug 151 - QtGui and QtNetwork are linked to QtCore through compilation
: QtGui and QtNetwork are linked to QtCore through compilation
Status: CLOSED FIXED
Product: PySide
Classification: Unclassified
Component: Shiboken
: HEAD
: All Linux
: P1 critical
Assigned To: Hugo Parente Lima
:
:
: 142
  Show dependency treegraph
 
Reported: 2010-02-17 13:38 EET by Didier Raboud
Modified: 2010-02-24 17:29 EET (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Didier Raboud 2010-02-17 13:38:58 EET
Hi all, 

while building pyside-shiboken from git in preparation for the future Debian
packages, I felt over the issue that (for now), QtGui and QtNetwork modules are
linked to the corresponding QtCore.so through compilation.

That means that the dynamic library linker would have to look into
/usr/path_where_I_put_compiled_Python_modules_with_specific_python_version/PySide/
to find QtCore.so, which is 'obviously' non-standard.

When I do a $ python -c "import PySide.QtNetwork", it fails because the dynamic
linker fails to find QtCore.so.

This is an abstract from a discussion we had in #debian-python about this
issue:

<OdyX> Is there any ldd specialist here ? I have big trouble understanding what
I am supposed to do with PySide.
<OdyX> For the short story: Pyside(-shiboken, non released, actually building
from git) build several modules, mimicking the Qt scheme.
<OdyX> I built all the libs successfully, even with several versions per python
version. 
<OdyX> The issue arises when I build the dependent modules.
<OdyX> e.g. QtNetwork.so (in /usr/lib/pyshared/python2.6/PySide/) needs
QtCore.so (in the same directory)
<OdyX> ldd fails to find it and I can't do a python -c "import
PySide.QtNetwork"
<OdyX> it works if I do a python -c "import PySide.QtCore ;import
PySide.QtNetwork"
<OdyX> I want to ship QtCore.so and QtNetwork.so in different packages (so
python-pyside.qtnetwork should depend on python-pyside.qtcore)
<OdyX> How can I "tell" QtNetwork.so to seek QtCore.so in the same directory ?
<OdyX> do I have to write the .symbols files ?
<jwilk> OdyX: Nope, nothing to do with that.
<OdyX> (I was planning to do so, but waiting on #563752 )
<OdyX> jwilk: from what I understood, dpkg-shlibdeps looks for the dependency,
but fails to find it
<OdyX> http://paste.debian.net/60237/ <- that's what happens with LD_DEBUG=libs
ldd /usr…/QtNetwork.so
<OdyX> can I somehow encode a LD_PRELOAD_PATH in QtNetwork.so ?
<jwilk> OdyX: Kind of, using rpath, but I don't think it's the correct
solution.
<jwilk> OdyX: Do you have build logs somewhere?
<OdyX> I disable rpath on purpose (lintian warning, …)
<Np237> OdyX: the upstream packaging is broken. You can’t expect to have
symbols from another library just because it’s in the same directory.
<Np237> And RPATH would be a solution, but it is not meant for such cases.
<OdyX> Np237: that was my guess… 
<Np237> The correct solution is to split the symbols needed by several modules
in a library, put the library in a private directory (/usr/lib/pyside) and to
use RPATH with this directory.
<Np237> And you’ll see in this case that lintian won’t complain about the
RPATH.
<OdyX> they already have a libpyside (probably for that purpose)
<OdyX>
http://alioth.debian.org/~odyx-guest/packages/pyside/pyside-shiboken_0.2.3+git20100217+fb265bc-1_amd64.build.bz2
<- buildlog
<OdyX> and is there no way to make the call to import PySide.QtNetwork trigger
an import PySide.QtCore before ?
<Np237> OdyX: you can move QtNetwork.so to _QtNetwork.so and make a
QtNetwork.py that does all that’s needed.
<Np237> i.e. import QtCore, from _QtNetwork import *
<OdyX> huh. Ugly
<POX> or you can import QtCore in pyside/__init__.py (IIRC, QtCore is used in
all pyside.* modules)
<Np237> POX: that won’t work for those who just import pyside.QtNetwork, will
it?
<POX> it should, IIRC

I may highlight the following sentences: 

<Np237> OdyX: the upstream packaging is broken. You can’t expect to have
symbols from another library just because it’s in the same directory.
<Np237> The correct solution is to split the symbols needed by several modules
in a library, put the library in a private directory (/usr/lib/pyside) and to
use RPATH with this directory.

And there is a libpyside…

I don't know what would be the proper way to handle this, but my feeling is
clearly that the actual one is wrong.

Thanks in advance and best regards, 

OdyX
Comment 1 Hugo Parente Lima 2010-02-17 14:02:48 EET
Until now, the only solution is to use rpath.

We still need to link QtGui to QtCore, because QtGui need some converters
declared on QtCore, we are aware of this problem, but to fix it we need to do 
some kind of re-enginering of all shiboken converter stuff and this require
alot of work.

We can't put these converters on libpyside, because they depends on types
declared on the library being binded, so there are 3 possible fixes:

1. Put all converter stuff in another library (e.g.
libPySideQtCoreConverters.so) and link the bindings against it.

2. Try to put all converters on header files, until now just few converters
aren't in headers, because they depends on other converters that need to be
declared beforehand.

3. Try to do some magic with CObjects.

We are studing all the possibilities to check what is possible and what isn't.
Comment 2 Hugo Parente Lima 2010-02-17 15:02:51 EET
I'm working on solution #2.
Comment 3 Hugo Parente Lima 2010-02-18 18:18:48 EET
Fixed on commits:
shiboken/d0442ea7fdd623238674334889b6b096fa07b9d0
pyside-shiboken/da44aaaef1f8206348177b90542aec8466e26b2a
Comment 4 Hugo Parente Lima 2010-02-18 18:22:00 EET
*** Bug 152 has been marked as a duplicate of this bug. ***