Qt Creator Clang Code Model 4.8.1 not working for cross-compile with cmake toolchain file



  • I use a basic QtQuick application with CMakeLists.txt generated by qtcreator.
    I configured a basic desktop kit (specifying C/CXX compiler, Qt version, standard cmake settings).
    This desktop kit works fine for building and the Code Model works as expected.

    I also a crosscompiling kit using a Yocto SDK in which I only set the sysroot (/opt/poky/2.2.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi), debugger and cmake.
    As cmake arguments I have:

    CMAKE_TOOLCHAIN_FILE:INTERNAL=/opt/poky/2.2.0/sysroots/x86_64-pokysdk-linux/usr/share/cmake/OEToolchainConfig.cmake
    

    Qtcreator is able to compile with this kit, but the Clang Code model fails to find type_traits.

    By using export QT_LOGGING_RULES=qtc.clang*=true from Qt Creator Clang Code Model, I see that the include path is limited to just:

    #include "..." search starts here:
    #include <...> search starts here:
     /home/appdev/builds/build-colibtest-Embedded_ARM_GNUEABI-Default
     /home/appdev/colibtest
     /home/appdev/builds/build-colibtest-Embedded_ARM_GNUEABI-Default/colibtest_autogen/include
     /opt/poky/2.2.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5
     /opt/poky/2.2.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtCore
     /opt/poky/2.2.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib/qt5/mkspecs/linux-oe-g++
     /opt/poky/2.2.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtQuick
     /opt/poky/2.2.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtQml
     /opt/poky/2.2.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtNetwork
     /opt/poky/2.2.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/qt5/QtGui
     /tmp/QtCreator-DoOePy/clang-uiheader-yzrCSu
     /opt/qtcreator/libexec/qtcreator/clang/lib/clang/7.0.0/include
    End of search list.
    

    I found a similar topic on code model failure in cross compiling in which the issue is resolved by setting CMAKE_SYSROOT.

    I tried this both in the Project Build settings and by adding it to the toolchain file with either
    set( CMAKE_SYSROOT $ENV{OECORE_TARGET_SYSROOT} ) or
    set( CMAKE_SYSROOT /opt/poky/2.2.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi )

    If I add it in the toolchain file I do not see CMAKE_SYSROOT in the project build settings.
    In both cases I don't see any difference in the code model behavior.

    Could this be a known issue that is resolved in a newer release or does anybody have a clue how to solve this?


 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.