Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. cmake: link to DEBUG imported targets
Forum Updated to NodeBB v4.3 + New Features

cmake: link to DEBUG imported targets

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
5 Posts 1 Posters 609 Views
  • 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.
  • A Offline
    A Offline
    AlNe
    wrote on last edited by AlNe
    #1

    Hi,

    I am using Qt on linux as provided by qt.io (opensource) and want to link to
    libQt5Core.so.5.14.1.debug

    I see that both the release and debug version exist:

    • using ls
    ls -lh Qt/5.14.1/gcc_64/lib/libQt5Core.so.5.14.1*
    -rwxr-xr-x 1 me me 6,7M Jan 23 10:42 Qt/5.14.1/gcc_64/lib/libQt5Core.so.5.14.1
    -rw-r--r-- 1 me me  74M Jan 24 08:11 Qt/5.14.1/gcc_64/lib/libQt5Core.so.5.14.1.debug
    
    • using file
    file Qt/5.14.1/gcc_64/lib/libQt5Core.so.5.14.1*
    
    Qt/5.14.1/gcc_64/lib/libQt5Core.so.5.14.1:       ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=23f01ce7437f4b9ff92313b47665f63ad4606f6c, for GNU/Linux 2.6.28, not stripped
    
    Qt/5.14.1/gcc_64/lib/libQt5Core.so.5.14.1.debug: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter *empty*, BuildID[sha1]=23f01ce7437f4b9ff92313b47665f63ad4606f6c, for GNU/Linux 2.6.28, with debug_info, not stripped
    

    The normal cmake build, pulls in
    Qt/5.14.1/gcc_64/lib/libQt5Core.so.5.14.1

    I do not want that.
    I want the power of choice, and I want to be able to choose
    Qt/5.14.1/gcc_64/lib/libQt5Core.so.5.14.1.debug

    Unfortunately the code seems to show that this is not possible:

    grep -n '_populate_Core_target_properties(' Qt/5.14.1/gcc_64/lib/cmake/Qt5Core/Qt5CoreConfig.cmake
    

    returns that Qt/5.14.1/gcc_64/lib/cmake/Qt5Core/Qt5CoreConfig.cmake only has the following (line 179)

        _populate_Core_target_properties(RELEASE "libQt5Core.so.5.14.1" "" FALSE)
    

    This shows that only the release version Qt/5.14.1/gcc_64/lib/libQt5Core.so.5.14.1 is used.

    Hacking and modifying the above line to the following change:

        _populate_Core_target_properties(DEBUG "libQt5Core.so.5.14.1.debug" "" FALSE)
    

    does not work, since then compiling gives:

    /usr/bin/ld: /home/me/Qt/5.14.1/gcc_64/lib/libQt5Core.so.5.14.1.debug: undefined reference to `ucal_clone_56'
    /usr/bin/ld: /home/me/Qt/5.14.1/gcc_64/lib/libQt5Core.so.5.14.1.debug: undefined reference to `ucnv_close_56'
                                                               ## ... more undefined references
    /usr/bin/ld: ../exes/Debug/go: no symbol version section for versioned symbol `qt_version_tag@@Qt_5.14'
    /usr/bin/ld: final link failed: nonrepresentable section on output
    collect2: error: ld returned 1 exit status
    

    Checking the documentation is unfortunately disappointing on this:
    https://doc.qt.io/qt-5/cmake-get-started.html#imported-targets

    The documentation mentions MAP_IMPORTED_CONFIG_COVERAGE, but grepping

    • grep -r MAP_IMPORTED_CONFIG_COVERAGE Qt/5.14.1/gcc_64/lib/cmake

    shows that this is used nowhere, so the documentation seems to be broken regarding this. Documentation says:

    If your project has custom CMake build configurations, you have to map your custom configuration to either the debug or the release Qt configuration.
    
    find_package(Qt5 COMPONENTS Core REQUIRED)
    
    set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_RELEASE} -fprofile-arcs -ftest-coverage")
    
    # set up a mapping so that the Release configuration for the Qt imported target is
    # used in the COVERAGE CMake configuration.
    set_target_properties(Qt5::Core PROPERTIES MAP_IMPORTED_CONFIG_COVERAGE "RELEASE")
    

    (Should I open a bug-repor on this via https://bugreports.qt.io/ ?)

    So any tips or hints appreciated.
    How can I link to the debug versions of the qt libs?
    Thanks

    A 1 Reply Last reply
    0
    • A AlNe

      Hi,

      I am using Qt on linux as provided by qt.io (opensource) and want to link to
      libQt5Core.so.5.14.1.debug

      I see that both the release and debug version exist:

      • using ls
      ls -lh Qt/5.14.1/gcc_64/lib/libQt5Core.so.5.14.1*
      -rwxr-xr-x 1 me me 6,7M Jan 23 10:42 Qt/5.14.1/gcc_64/lib/libQt5Core.so.5.14.1
      -rw-r--r-- 1 me me  74M Jan 24 08:11 Qt/5.14.1/gcc_64/lib/libQt5Core.so.5.14.1.debug
      
      • using file
      file Qt/5.14.1/gcc_64/lib/libQt5Core.so.5.14.1*
      
      Qt/5.14.1/gcc_64/lib/libQt5Core.so.5.14.1:       ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=23f01ce7437f4b9ff92313b47665f63ad4606f6c, for GNU/Linux 2.6.28, not stripped
      
      Qt/5.14.1/gcc_64/lib/libQt5Core.so.5.14.1.debug: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter *empty*, BuildID[sha1]=23f01ce7437f4b9ff92313b47665f63ad4606f6c, for GNU/Linux 2.6.28, with debug_info, not stripped
      

      The normal cmake build, pulls in
      Qt/5.14.1/gcc_64/lib/libQt5Core.so.5.14.1

      I do not want that.
      I want the power of choice, and I want to be able to choose
      Qt/5.14.1/gcc_64/lib/libQt5Core.so.5.14.1.debug

      Unfortunately the code seems to show that this is not possible:

      grep -n '_populate_Core_target_properties(' Qt/5.14.1/gcc_64/lib/cmake/Qt5Core/Qt5CoreConfig.cmake
      

      returns that Qt/5.14.1/gcc_64/lib/cmake/Qt5Core/Qt5CoreConfig.cmake only has the following (line 179)

          _populate_Core_target_properties(RELEASE "libQt5Core.so.5.14.1" "" FALSE)
      

      This shows that only the release version Qt/5.14.1/gcc_64/lib/libQt5Core.so.5.14.1 is used.

      Hacking and modifying the above line to the following change:

          _populate_Core_target_properties(DEBUG "libQt5Core.so.5.14.1.debug" "" FALSE)
      

      does not work, since then compiling gives:

      /usr/bin/ld: /home/me/Qt/5.14.1/gcc_64/lib/libQt5Core.so.5.14.1.debug: undefined reference to `ucal_clone_56'
      /usr/bin/ld: /home/me/Qt/5.14.1/gcc_64/lib/libQt5Core.so.5.14.1.debug: undefined reference to `ucnv_close_56'
                                                                 ## ... more undefined references
      /usr/bin/ld: ../exes/Debug/go: no symbol version section for versioned symbol `qt_version_tag@@Qt_5.14'
      /usr/bin/ld: final link failed: nonrepresentable section on output
      collect2: error: ld returned 1 exit status
      

      Checking the documentation is unfortunately disappointing on this:
      https://doc.qt.io/qt-5/cmake-get-started.html#imported-targets

      The documentation mentions MAP_IMPORTED_CONFIG_COVERAGE, but grepping

      • grep -r MAP_IMPORTED_CONFIG_COVERAGE Qt/5.14.1/gcc_64/lib/cmake

      shows that this is used nowhere, so the documentation seems to be broken regarding this. Documentation says:

      If your project has custom CMake build configurations, you have to map your custom configuration to either the debug or the release Qt configuration.
      
      find_package(Qt5 COMPONENTS Core REQUIRED)
      
      set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_RELEASE} -fprofile-arcs -ftest-coverage")
      
      # set up a mapping so that the Release configuration for the Qt imported target is
      # used in the COVERAGE CMake configuration.
      set_target_properties(Qt5::Core PROPERTIES MAP_IMPORTED_CONFIG_COVERAGE "RELEASE")
      

      (Should I open a bug-repor on this via https://bugreports.qt.io/ ?)

      So any tips or hints appreciated.
      How can I link to the debug versions of the qt libs?
      Thanks

      A Offline
      A Offline
      AlNe
      wrote on last edited by AlNe
      #2

      By the way:

      ldd ~/Qt/5.14.1/gcc_64/lib/libQt5Core.so.5.14.1*
      shows

      /home/me/Qt/5.14.1/gcc_64/lib/libQt5Core.so.5.14.1:
      	linux-vdso.so.1 (0x00007fff63ffe000)
      	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f9095f8c000)
      	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f9095d6e000)
      	libicui18n.so.56 => /home/me/Qt/5.14.1/gcc_64/lib/libicui18n.so.56 (0x00007f90958d5000)
      	libicuuc.so.56 => /home/me/Qt/5.14.1/gcc_64/lib/libicuuc.so.56 (0x00007f909551d000)
      	libicudata.so.56 => /home/me/Qt/5.14.1/gcc_64/lib/libicudata.so.56 (0x00007f9093b3a000)
      	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f9093b35000)
      	libgthread-2.0.so.0 => /lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007f9093b2e000)
      	libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f9093a0f000)
      	libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f909388b000)
      	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f9093708000)
      	#... etc
      
      /home/me/Qt/5.14.1/gcc_64/lib/libQt5Core.so.5.14.1.debug:
      	not a dynamic executable
      

      which is weird,
      since file ~/Qt/5.14.1/gcc_64/lib/libQt5Core.so.5.14.1.debug shows

      /home/me/Qt/5.14.1/gcc_64/lib/libQt5Core.so.5.14.1.debug: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter *empty*, BuildID[sha1]=23f01ce7437f4b9ff92313b47665f63ad4606f6c, for GNU/Linux 2.6.28, with debug_info, not stripped
      

      and objdump -f ~/Qt/5.14.1/gcc_64/lib/libQt5Core.so.5.14.1* shows

      /home/me/Qt/5.14.1/gcc_64/lib/libQt5Core.so.5.14.1:     file format elf64-x86-64
      architecture: i386:x86-64, flags 0x00000150:
      HAS_SYMS, DYNAMIC, D_PAGED
      start address 0x00000000000a5780
      
      
      /home/me/Qt/5.14.1/gcc_64/lib/libQt5Core.so.5.14.1.debug:     file format elf64-x86-64
      architecture: i386:x86-64, flags 0x00000150:
      HAS_SYMS, DYNAMIC, D_PAGED
      start address 0x00000000000a5780
      
      1 Reply Last reply
      0
      • A Offline
        A Offline
        AlNe
        wrote on last edited by
        #3

        I now think that Qt/5.14.1/gcc_64/lib/libQt5Core.so.5.14.1.debug are only debugging symbols. (ref)

        I have not installed the sources with the online installer.
        I think that if I do install the sources, I will probably be able to debug into the qt library code.
        Can someone confirm this?
        Thanks.

        A 1 Reply Last reply
        0
        • A AlNe

          I now think that Qt/5.14.1/gcc_64/lib/libQt5Core.so.5.14.1.debug are only debugging symbols. (ref)

          I have not installed the sources with the online installer.
          I think that if I do install the sources, I will probably be able to debug into the qt library code.
          Can someone confirm this?
          Thanks.

          A Offline
          A Offline
          AlNe
          wrote on last edited by
          #4

          @AlNe said in cmake: link to DEBUG imported targets:

          I now think that Qt/5.14.1/gcc_64/lib/libQt5Core.so.5.14.1.debug are only debugging symbols. (ref)

          I have not installed the sources with the online installer.
          I think that if I do install the sources, I will probably be able to debug into the qt library code.
          Can someone confirm this?
          Thanks.

          Nope, simply using the maintenance tool to get the sources, is not enough. I still get assembly stuff if I debug into library code such as QTimer.

          A 1 Reply Last reply
          0
          • A AlNe

            @AlNe said in cmake: link to DEBUG imported targets:

            I now think that Qt/5.14.1/gcc_64/lib/libQt5Core.so.5.14.1.debug are only debugging symbols. (ref)

            I have not installed the sources with the online installer.
            I think that if I do install the sources, I will probably be able to debug into the qt library code.
            Can someone confirm this?
            Thanks.

            Nope, simply using the maintenance tool to get the sources, is not enough. I still get assembly stuff if I debug into library code such as QTimer.

            A Offline
            A Offline
            AlNe
            wrote on last edited by
            #5

            Nope, simply using the maintenance tool to get the sources, is not enough. I still get assembly stuff if I debug into library code such as QTimer.

            Ok, I can now see the sources, by doing this:

            Tools->Options->Debugger->General->Add Qt Sources...
            and selecting
            /home/me/Qt/5.14.1/Src

            which results in:

            Source path: /home/qt/work/qt
            Target path: /home/me/Qt/5.14.1/Src
            
            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