From: Alan W. I. <ir...@be...> - 2010-03-04 21:05:40
|
On 2010-03-04 10:04-0500 Hazen Babcock wrote: > Did you mean to send [your first post on this topic] to the dev mailing list? Yes, I have now forwarded that post to the list, and this post is on list as well. > > Do you have another version of Qt on your system in a place where it could > get picked up instead? Yes. In fact, during my research to answer you in more detail, I actually stumbled on an amazingly simple solution to this complex issue. First I collected a whole bunch of data with nm, ldd, and readelf, and the conclusion is that PLplot and the /home/software/qtsdk-2010.01/qt/lib/ version of Qt4 are linked perfectly with correct DT_RPATH values. The "undefined" symbol, _Z9qBadAllocv is defined by /home/software/qtsdk-2010.01/qt/lib/libQtCore.so.4 but not the system version /usr/lib/libQtCore.so.4. Presumably this symbol reflects some API that was added somewhere between my system version of Qt4 (4.5.2) and the downloaded version of Qt4 (4.6.1) in /home/software/qtsdk-2010.01/qt/lib which is why it is undefined for the system version. Second, I looked closely at your pyqt4 example, and the command from PyQt4 import QtCore, QtGui loads, /usr/lib/python-support/python-qt4/python2.5/PyQt4/QtCore.so /usr/lib/python-support/python-qt4/python2.5/PyQt4/QtGui.so which from ldd data (without LD_LIBRARY_PATH set) on those plug-ins also loads /usr/lib/libQtCore.so.4 and /usr/lib/libQtGui.so.4 which are the _old_ system versions of those libraries. Your pyqt4 example later executes the command import plplot_pyqt4 which dynamically loads plplot_pyqt4.so and (according to ldd data on that extension module) libQtSvg.so.4, libQtXml.so.4, libQtGui.so.4, and libQtCore.so.4. Since at this point, libQtSvg.so.4 and libQtXml.so.4 have not previously been loaded, they are loaded from the correct /home/software/qtsdk-2010.01/qt/lib, but libQtGui.so.4, and libQtCore.so.4 have already been loaded from the old versions so that is not done again, and bingo! we have the undefined symbol issue. The amazingly simple fix for this complex issue is to do import plplot_pyqt4 _before_ from PyQt4 import QtCore, QtGui in the example. The first import command loads in consistent versions (from /home/software/qtsdk-2010.01/qt/lib) for all Qt libraries used by plplot_pyqt4 and all Qt libraries recursively used by those libraries. Then the second "from PyQt4 ..." command also uses those consistent versions since they are already loaded. This fix (with comments in the code as to why) has been done for revision 10844. What a relief to finally arrive at such a simple solution to this complex dynamic loading issue! It strongly reminds me (probably for exactly the same reasons) of all the library ordering shenanigans we had to go through in the static library era. Alan __________________________ Alan W. Irwin Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); PLplot scientific plotting software package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __________________________ Linux-powered Science __________________________ |