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

Cmake compiler check does not seem to take into account sysroot settings

    XMLWordPrintable

    Details

      Description

      In case I set up a compiler toolchain for a yocto distribution with the following kit configuration:
      Device Type: Generic Linux Device
      Sysroot: /opt/yocto/build/tmp/sysroots/baytrail_soc
      Compiler: /opt/yocto/build/tmp/sysroots/x86_64-linux/usr/bin/x86_64-poky-linux/x86_64-poky-linux-gcc
      Qt version: None
      CMake Tool: /usr/local/bin/cmake (points to CMake 3.3.1)
      CMake Generator: CodeBlocks - Unix Makefiles
      CMake Configuration:
      CMAKE_CXX_COMPILER:STRING=%{Compiler:Executable}
      QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable}

      The cmake check for the compiler fails when trying to link the cmake compiler test application with the following error:

      Running "/usr/local/bin/cmake /home/volkerv/Repos/Software '-GCodeBlocks - Unix Makefiles' -DCMAKE_CXX_COMPILER:STRING=/opt/yocto/build/tmp/sysroots/x86_64-linux/usr/bin/x86_64-poky-linux/x86_64-poky-linux-gcc -DQT_QMAKE_EXECUTABLE:STRING=" in /home/volkerv/Repos/Software/temp/baytrail_soc/Debug.

      The C++ compiler
      "/opt/yocto/build/tmp/sysroots/x86_64-linux/usr/bin/x86_64-poky-linux/x86_64-poky-linux-gcc"
      is not able to compile a simple test program.

      It fails with the following output:

      Change Dir: /home/volkerv/Repos/Software/temp/baytrail_soc/Debug/CMakeFiles/CMakeTmp

      Run Build Command:"/usr/bin/gmake" "cmTC_0e1a6/fast"

      /usr/bin/gmake -f CMakeFiles/cmTC_0e1a6.dir/build.make
      CMakeFiles/cmTC_0e1a6.dir/build

      gmake[1]: Entering directory
      '/home/volkerv/Repos/Software/temp/baytrail_soc/Debug/CMakeFiles/CMakeTmp'

      Building CXX object CMakeFiles/cmTC_0e1a6.dir/testCXXCompiler.cxx.o

      /opt/yocto/build/tmp/sysroots/x86_64-linux/usr/bin/x86_64-poky-linux/x86_64-poky-linux-gcc
      -o CMakeFiles/cmTC_0e1a6.dir/testCXXCompiler.cxx.o -c
      /home/volkerv/Repos/Software/temp/baytrail_soc/Debug/CMakeFiles/CMakeTmp/testCXXCompiler.cxx

      Linking CXX executable cmTC_0e1a6

      /usr/local/bin/cmake -E cmake_link_script
      CMakeFiles/cmTC_0e1a6.dir/link.txt --verbose=1

      /opt/yocto/build/tmp/sysroots/x86_64-linux/usr/bin/x86_64-poky-linux/x86_64-poky-linux-gcc
      CMakeFiles/cmTC_0e1a6.dir/testCXXCompiler.cxx.o -o cmTC_0e1a6 -rdynamic

      /opt/yocto/build/tmp/sysroots/x86_64-linux/usr/libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/5.3.0/ld:
      cannot find crt1.o: No such file or directory

      /opt/yocto/build/tmp/sysroots/x86_64-linux/usr/libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/5.3.0/ld:
      cannot find crti.o: No such file or directory

      /opt/yocto/build/tmp/sysroots/x86_64-linux/usr/libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/5.3.0/ld:
      cannot find crtbegin.o: No such file or directory

      /opt/yocto/build/tmp/sysroots/x86_64-linux/usr/libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/5.3.0/ld:
      cannot find -lgcc

      /opt/yocto/build/tmp/sysroots/x86_64-linux/usr/libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/5.3.0/ld:
      cannot find -lgcc_s

      /opt/yocto/build/tmp/sysroots/x86_64-linux/usr/libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/5.3.0/ld:
      cannot find -lc

      /opt/yocto/build/tmp/sysroots/x86_64-linux/usr/libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/5.3.0/ld:
      cannot find -lgcc

      /opt/yocto/build/tmp/sysroots/x86_64-linux/usr/libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/5.3.0/ld:
      cannot find -lgcc_s

      /opt/yocto/build/tmp/sysroots/x86_64-linux/usr/libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/5.3.0/ld:
      cannot find crtend.o: No such file or directory

      /opt/yocto/build/tmp/sysroots/x86_64-linux/usr/libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/5.3.0/ld:
      cannot find crtn.o: No such file or directory

      collect2: error: ld returned 1 exit status

      CMakeFiles/cmTC_0e1a6.dir/build.make:97: recipe for target 'cmTC_0e1a6'
      failed

      The only way to get things working again is to add the following CMake configuration adjustments which bypassed the compiler check

      CMAKE_CXX_COMPILER_WORKS:STRING=1

      But this shouldn't be the solution. No idea what has to be passed to cmake to avoid that problem. Normally I adjust the compiler settings for cross compilation within my CMakeLists.txt files. That's why it worked in former Qt creator versions I guess. But normally it should be possible to let qt creator select all the stuff based on the kit configuration. If only it would pass at least the compiler check successfully

        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:
                volki21 Volker Vogelhuber
              • Votes:
                6 Vote for this issue
                Watchers:
                11 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes