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

Qt Creator does not pass the sysroot to CMake

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Duplicate
    • Affects Version/s: Qt Creator 4.3.0
    • Fix Version/s: None
    • Labels:
    • Environment:
      OS: Ubuntu 17.04

      Qt Creator: 4.3.0

      CMake: 3.7

      Cross-compiler: gcc-linaro-4.9-2015.02-3-x86_64_arm-linux-gnueabihf

      Description

      I have a Kit configured for cross-compilation:

      Device type: Generic Linux Device
      Sysroot: /home/julien/vqm_build/build/rootfs
      Compiler: /home/julien/Tools/gcc-...-gnueabihf/bin/arm-linux-gnueabihf-gcc
      Qt version: Qt 5.6.2
      CMake tool: System CMake at /usr/local/bin/cmake
      CMake generator: <none> - Unix Makefiles, Platform: <none>, Toolset: <none>

      This configuration works properly when using a qmake .pro file. However this configuration fails to work with a CMakeLists.txt file and results in linking errors ("libraries cannot be found"). I found that it fails to pass the sysroot variable to CMake. This is confirmed by checking the CMake configuration field in the Kit:

      CMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx}
      CMAKE_C_COMPILER:STRING=%{Compiler:Executable:C}
      CMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX}
      QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable}

      Adding the following line resolves the linking issues:

      CMAKE_SYSROOT:STRING=%{SysRoot:FilePath}

      Apparently this is a know issue:

      https://bugreports.qt.io/browse/QTCREATORBUG-16155

      The patch is available but was never pushed and it is unclear why. I understand that the OPĀ had other issues which were notĀ solved by this fix. However I think the fix is legit as the sysroot is a critical variable when doing cross-compilation that needs to be passed to CMake.

        Attachments

          Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Activity

              People

              • Assignee:
                hunger Tobias Hunger
                Reporter:
                julien-l Julien Lemaitre
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes