Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Please show me the way to debug qt 5.3 with sources
Forum Updated to NodeBB v4.3 + New Features

Please show me the way to debug qt 5.3 with sources

Scheduled Pinned Locked Moved General and Desktop
10 Posts 4 Posters 5.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dmitriy V. Shmykov
    wrote on last edited by
    #1

    Hi.

    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.

    1 Reply Last reply
    0
    • C Offline
      C Offline
      clochydd
      wrote on last edited by
      #2

      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?

      1 Reply Last reply
      0
      • D Offline
        D Offline
        Dmitriy V. Shmykov
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • jeremy_kJ Offline
          jeremy_kJ Offline
          jeremy_k
          wrote on last edited by
          #4

          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.

          Asking a question about code? http://eel.is/iso-c++/testcase/

          1 Reply Last reply
          0
          • D Offline
            D Offline
            Dmitriy V. Shmykov
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0
            • jeremy_kJ Offline
              jeremy_kJ Offline
              jeremy_k
              wrote on last edited by
              #6

              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
              $ 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.

              Asking a question about code? http://eel.is/iso-c++/testcase/

              1 Reply Last reply
              0
              • D Offline
                D Offline
                Dmitriy V. Shmykov
                wrote on last edited by
                #7

                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.

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  Dmitriy V. Shmykov
                  wrote on last edited by
                  #8

                  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".

                  1 Reply Last reply
                  0
                  • jeremy_kJ Offline
                    jeremy_kJ Offline
                    jeremy_k
                    wrote on last edited by
                    #9

                    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.

                    Asking a question about code? http://eel.is/iso-c++/testcase/

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      andreyc
                      wrote on last edited by
                      #10

                      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
                      cd qtbase-opensource-src-5.3.0
                      ./configure -prefix /where/to/install -opensource -confirm-license -debug
                      make
                      make install
                      @
                      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
                      mkdir build-qtmultimedia
                      cd build-qtmultimedia
                      /where/qtbase/installed/bin/qmake -r ../qtmultimedia-opensource-src-5.3.0 CONFIG+=debug
                      make
                      make install
                      @

                      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.

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved