Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-27008

CMake sets RUNPATH to bad/incorrect Qt lib dir

    XMLWordPrintable

Details

    • 3ba00ac39f (qt-creator/qt-creator/7.0) 3ba00ac39f (qt-creator/qt-creator/master) 3ba00ac39f (qt-creator/tqtc-qt-creator/7.0) 3ba00ac39f (qt-creator/tqtc-qt-creator/master) 3ba00ac39f (qt-creator/tqtc-qt-creator/qds-3.1)

    Description

      After building Qt Creator from sources with CMake, I get:

      $ bin/qtcreator
      bin/qtcreator: error while loading shared libraries: libQt6Concurrent.t.so.6: cannot open shared object file: No such file or directory
      $ ldd bin/qtcreator
              linux-vdso.so.1 (0x00007ffdc99fa000)
              libExtensionSystem.so.6 => /home/tjmaciei/obj/qt/installed/bin/../lib64/qtcreator/libExtensionSystem.so.6 (0x00007f174f777000)
              libUtils.so.6 => /home/tjmaciei/obj/qt/installed/bin/../lib64/qtcreator/libUtils.so.6 (0x00007f174f347000)
              libAggregation.so.6 => /home/tjmaciei/obj/qt/installed/bin/../lib64/qtcreator/libAggregation.so.6 (0x00007f174f33c000)
              libQt6Concurrent.t.so.6 => not found
              libQt6Core5Compat.t.so.6 => not found
              libQt6Widgets.t.so.6 => not found
              libQt6Gui.t.so.6 => not found
              libGLX.so.0 => /lib64/libGLX.so.0 (0x00007f174f2f2000)
              libOpenGL.so.0 => /lib64/libOpenGL.so.0 (0x00007f174f2c5000)
              libQt6Network.t.so.6 => not found
              libQt6Core.t.so.6 => not found
              libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f174f0aa000)
              libm.so.6 => /lib64/libm.so.6 (0x00007f174efc7000)
              libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f174efad000)
              libc.so.6 => /lib64/libc.so.6 (0x00007f174ed7e000)
              libQt6Widgets.t.so.6 => not found
              libQt6Test.t.so.6 => not found
              libQt6Gui.t.so.6 => not found
              libQt6Core.t.so.6 => not found
              libQt6Qml.t.so.6 => not found
              libQt6Xml.t.so.6 => not found
              libQt6Network.t.so.6 => not found
              libQt6Widgets.t.so.6 => not found
              libQt6Core5Compat.t.so.6 => not found
              libQt6Gui.t.so.6 => not found
              libQt6Core.t.so.6 => not found
              libQt6Core.t.so.6 => not found
              libX11.so.6 => /lib64/libX11.so.6 (0x00007f174ec32000)
              libGLdispatch.so.0 => /lib64/libGLdispatch.so.0 (0x00007f174eb7a000)
              /lib64/ld-linux-x86-64.so.2 (0x00007f174f7ee000)
              libxcb.so.1 => /lib64/libxcb.so.1 (0x00007f174eb4f000)
              libXau.so.6 => /lib64/libXau.so.6 (0x00007f174eb48000)
      

      This happens because the RPATH contains a nonsensical entry:

      $ readelf -d bin/qtcreator | grep PATH 
       0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib64/qtcreator:$ORIGIN/../lib64/Qt/lib:$ORIGIN/../lib64/qtcreator/plugins]
      

      That "/Qt/lib" is just wrong. It comes from QtCreatorAPIInternal.cmake:

      file(RELATIVE_PATH _PLUGIN_TO_LIB "/${_IDE_PLUGIN_PATH}" "/${_IDE_LIBRARY_PATH}")
      file(RELATIVE_PATH _PLUGIN_TO_QT "/${_IDE_PLUGIN_PATH}" "/${_IDE_LIBRARY_BASE_PATH}/Qt/lib")
      file(RELATIVE_PATH _LIB_TO_QT "/${_IDE_LIBRARY_PATH}" "/${_IDE_LIBRARY_BASE_PATH}/Qt/lib")
      

      That's hardcoded, instead of guessed from Qt. Since it obviously makes no sense and does not come from inspecting the Qt builds, it can't be right.

      CMake config:

      -DBUILD_WITH_PCH=OFF
      -DCMAKE_BUILD_TYPE=Custom
      -DCMAKE_CXX_COMPILER=g++
      -DCMAKE_CXX_FLAGS='-O3 -march=skylake-avx512 -mprefer-vector-width=256 -maes -mno-rdseed -fdiagnostics-color=always'
      -DCMAKE_C_COMPILER=gcc
      -DCMAKE_C_FLAGS='-O3 -march=skylake-avx512 -mprefer-vector-width=256 -maes -mno-rdseed -fdiagnostics-color=always'
      -DCMAKE_EXE_LINKER_FLAGS='-flto=auto'
      -DCMAKE_INSTALL_LIBDIR=lib64
      -DCMAKE_INSTALL_PREFIX=$HOME/obj/qt/installed
      -DCMAKE_MODULE_LINKER_FLAGS='-Wl,--as-needed -flto=auto'
      -DCMAKE_SHARED_LINKER_FLAGS='-Wl,-O1 -Wl,--as-needed -flto=auto'
      

      Attachments

        Activity

          People

            con Eike Ziller
            thiago Thiago Macieira
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: