Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Please show me the way to debug qt 5.3 with sources
A typical problem with debugging using Qt sources and Qt Creator.
I installed Qt 5.3 from the run-file. I have read lots of forum posts about the ways how to make Qt Creator work with Qt sources (letting user go into them in his debugging session). So in Qt Creator 3.1.1 with Qt 5.3 I tried to set "Tools > Options > Debugger > General" and added Qt sources path. After pointing Qt sources (e.g. <home>/Qt5.3.0/5.3/Src) I've got this strange mapping
/var/tmp/qt-src -> <home>/Qt5.3.0/5.3/Src
I've tried to use this mapping in debugging QStringList with no result (debugger didn't went into QStringList sources). So I tried another mapping
<home>/Qt5.3.0/5.3/Src -> <home>/Qt5.3.0/5.3/gcc_64/lib
with the same result.
So I want to ask you if there's a way to make Qt Creator to debug using Qt sources. What mapping should I use or I should do something else with Qt Creator or Qt installation.
clochydd last edited by
Hi, you do not need the source files for debugging - the information is linked to the debugging libraries. I've installed 5.3 the same way and debugging shows the contents of the source files.
Are you sure you run in Debug mode?
I'm sure. I've chosen the debug mode when started to... debug. In QtCreator it can be done in one click. I think that somehow the debug info is missing in those libraries I'm linking with. So the program I made is in debug mode but the stack info in the Qt is still locked because Qt libs I'm linking with miss the debug info.
Debug mode in Creator applies to the application being built, not the libraries it links against. You can see what it does by looking at the project build settings in the Projects tab.
I don't see debugging versions of the libraries in the x86-64 Linux 5.3.0 package. With the Qt source installed, building a debug copy can be done by invoking "qmake CONFIG+=debug" followed by make and make install in each of the Qt module directories.
Note that make install will overwrite the prebuilt libraries.
I have Qt 5.3 installed in <home>/Qt5.3.0 so the Qt libraries that my program depends on are located in <home>/Qt5.3.0/5.3/gcc_64/lib. Having a little experience with Qt I have to ask what commands with prefixes should I call to store debug libs in the <home>/Qt5.3.0/5.3/gcc_64/lib directory or in the <home>/Qt5.3.0/5.3/gcc_64/lib-debug to have an opportunity to link with release or debug versions when I need to.
This will replace the non-debug libraries with debug versions:
$ mkdir -p <home>/Qt5.3.0/build/qtbase
$ cd <home>/Qt5.3.0/build/qtbase
$ <home>/Qt5.3.0/gcc_64/bin/qmake <home>/Qt5.3.0/Src/qtbase/qtbase.pro
$ make install
Repeat for any other modules desired.
Getting to a point that switching between debug and non-debug builds is easy, well, that's a harder question. One option is to rename lib/ to lib.nodebug/ prior to make install, then rename the new lib/ to lib.debug/. Create a lib symlink to point to whichever version is appropriate at the moment.
Thanks! But I think before the building I should run "./configure" from "<home>/Qt5.3.0/Src" to create qconfig.[cpp, h]. Without it make gives error because of missing "qconfig.h" file.
It seems that libs built from Qt sources will differ from original that can be installed by default.
When building libQt5Gui.so it gave error "/usr/bin/ld: error: cannot find -lEGL". But when I call "ldd libQt5Gui.so" it gives a list of libs without any libEGL entries. I can't check whether this libEGL is static-linked because "nm libQt5Gui.so" tells "nm: libQt5Gui.so: no symbols".
Bummer. It looks like this doesn't quite work for qtbase. You can copy qconfig.h from the build tree, but qconfig.cpp will still be missing. It does work for the other modules.
Running configure means generating an entirely new build. That is of course a legitimate option. The reference to a missing libEGL means that configure isn't being invoked correctly for the platform being built.
andreyc last edited by
I would suggest to download a source code from Qt and build from there.
If you need just basic Qt (core, widgets, network) then "qtbase":http://download.qt-project.org/official_releases/qt/5.3/5.3.0/submodules/qtbase-opensource-src-5.3.0.tar.xz will be enough. And build time is not so big.
tar xJf qtbase-opensource-src-5.3.0.tar.xz
./configure -prefix /where/to/install -opensource -confirm-license -debug
After you build and installed qtbase you can build other modules using the qtbase. Download module "qtmultimedia":http://download.qt-project.org/official_releases/qt/5.3/5.3.0/submodules/qtmultimedia-opensource-src-5.3.0.tar.xz for example
tar xJf qtmultimedia-opensource-src-5.3.0.tar.xz
/where/qtbase/installed/bin/qmake -r ../qtmultimedia-opensource-src-5.3.0 CONFIG+=debug
or download full "Qt source code":http://download.qt-project.org/official_releases/qt/5.3/5.3.0/single/qt-everywhere-opensource-src-5.3.0.tar.xz
And tar, configure. etc.
QtWebkit will take most of build time, so if you don't need qtwebkit then don't forget to disable it in configure.