[Qt-interest] Qt on Linux

Oliver.Knoll at comit.ch Oliver.Knoll at comit.ch
Fri Jan 9 13:44:46 CET 2009


Andreas Pakulat wrote on Friday, January 09, 2009 1:21 PM:

>>> ...
>>> #0 ??
>>> /usr/lib/libQtCore.so.4 #1 ??
>>> ...
>>
>> Your program is hitting the release libraries because you linked
>> against them (libQtCore.so)! The DEBUG Qt libraries contain a 'd' in
>> their name (libQtCored.so),...
>
> No, that only happens on Windows. Linux allows to split libraries and
> debug symbols, hence you get libQtCore.so.4 and libQtCore.so.4.debug.

Ups, it's been a while since I developed with Qt on Linux, and I did not know about splitting symbols like this - I thought this 'd'-name convention was platform-independent as well ;) And so far I never cared to debug the Qt libraries, at least not on Linux.

So the solution seems to be: "Make sure the proper Qt library (with debug symbols) is taken when linking/executing your application!"

Setting the LD_LIBRARY_PATH comes to my mind. I *think* you also have to make sure that already at *compile time* you have to make sure that the proper Qt library is taken (again by setting the LD_LIBRARY_PATH probably), because I think that by default the path to the Qt library is compiled into the executable (-rpath) - at least when using the *.pro/qmake approach.

That means that even when you properly set the LD_LIBRARY_PATH to e.g. /home/user/myQtVersion/lib first (before /usr/lib) the executable would still look into /usr/lib *first*, because that's the path which got compiled into the executable (see the -rpath option of the gcc linker). Only if the library is *not* found in the RPATH (runtime path?) then the LD_LIBRARY_PATH is evaluated.

But again, it's been a while when I compiled on Linux, so I might be completely wrong here again and setting LD_LIBRARY_PATH, just before running your executable, to point to your Qt debug libary first might be sufficient.

Oh, and the command line tool 'ldd' is your friend, too: it shows you the paths to which your executable currently links against! So if it contains the Linux distro's Qt version (most probably without debug symbols) under /usr/lib then you won't be able to debug the Qt library!


Alternatively, if you don't feel like messing around with LD_LIBRARY_PATH, install the Linux distro "Qt debug" and "source" packages (or "Qt develop" package" or whatever it is called) which should be available as well (this implies off course that you are stuck with the Qt library version, whatever your Linux distro offers as the latest).

Cheers, Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22




More information about the Qt-interest-old mailing list