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. What can cause the CXX compiler to fail? (Cross compiling)

What can cause the CXX compiler to fail? (Cross compiling)

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
cross compilearm7yocto
3 Posts 2 Posters 239 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.
  • H Offline
    H Offline
    HenrikZ
    wrote on 16 Dec 2024, 14:46 last edited by
    #1

    When configuring the "Build & Run" for an Arm cortex A7 processor, the CXX compiler is failing even before it has tried to compile the actual project (it seems that Qt creator might have a small piece of code to confirm, that the settings for compiler works). The questions is, what can cause the CXX compiler to fail in CMakeTestCXXCompiler.cmake (line 70 -> if(NOT CMAKE_CXX_COMPILER_WORKS))
    The CXX compiler that the error is referring to is defined under build environment as:

    CXX="arm-poky-linux-gnueabi-g++  -mthumb -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7 -fstack-protector-strong  -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 --sysroot=$SDKTARGETSYSROOT"
    

    I have tried to compile a very simple program outside Qt Creator (in the terminal) using the above settings for the compiler, and it produces an output file without any problems. When compiled from Qt Creator, I get the following issues:

    /opt/fsl-imx-wayland/6.6-scarthgap-imx-full-image/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++"
    
    is not able to compile a simple test program.
    
    It fails with the following output:
    
      Change Dir: '/home/sm/development_HZ/GreetingsMCU/build/iMX7ULP_KIT-Debug/CMakeFiles/CMakeScratch/TryCompile-9OLwoV'
    
      Run Build Command(s): /usr/bin/ninja -v cmTC_ec202
      [1/2] /opt/fsl-imx-wayland/6.6-scarthgap-imx-full-image/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++   -DQT_QML_DEBUG  -fdiagnostics-color=always -o CMakeFiles/cmTC_ec202.dir/testCXXCompiler.cxx.o -c /home/sm/development_HZ/GreetingsMCU/build/iMX7ULP_KIT-Debug/CMakeFiles/CMakeScratch/TryCompile-9OLwoV/testCXXCompiler.cxx
      [2/2] : && /opt/fsl-imx-wayland/6.6-scarthgap-imx-full-image/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++ -DQT_QML_DEBUG  CMakeFiles/cmTC_ec202.dir/testCXXCompiler.cxx.o -o cmTC_ec202   && :
      FAILED: cmTC_ec202
      : && /opt/fsl-imx-wayland/6.6-scarthgap-imx-full-image/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++ -DQT_QML_DEBUG  CMakeFiles/cmTC_ec202.dir/testCXXCompiler.cxx.o -o cmTC_ec202   && :
      /opt/fsl-imx-wayland/6.6-scarthgap-imx-full-image/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/13.3.0/ld: cannot find Scrt1.o: No such file or directory
      /opt/fsl-imx-wayland/6.6-scarthgap-imx-full-image/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/13.3.0/ld: cannot find crti.o: No such file or directory
      /opt/fsl-imx-wayland/6.6-scarthgap-imx-full-image/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/13.3.0/ld: cannot find crtbeginS.o: No such file or directory
      /opt/fsl-imx-wayland/6.6-scarthgap-imx-full-image/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/13.3.0/ld: cannot find -lstdc++: No such file or directory
      /opt/fsl-imx-wayland/6.6-scarthgap-imx-full-image/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/13.3.0/ld: cannot find -lm: No such file or directory
      /opt/fsl-imx-wayland/6.6-scarthgap-imx-full-image/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/13.3.0/ld: cannot find -lgcc_s: No such file or directory
      /opt/fsl-imx-wayland/6.6-scarthgap-imx-full-image/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/13.3.0/ld: cannot find -lgcc: No such file or directory
      /opt/fsl-imx-wayland/6.6-scarthgap-imx-full-image/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/13.3.0/ld: cannot find -lc: No such file or directory
      /opt/fsl-imx-wayland/6.6-scarthgap-imx-full-image/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/13.3.0/ld: cannot find -lgcc_s: No such file or directory
      /opt/fsl-imx-wayland/6.6-scarthgap-imx-full-image/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/13.3.0/ld: cannot find -lgcc: No such file or directory
      /opt/fsl-imx-wayland/6.6-scarthgap-imx-full-image/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/13.3.0/ld: cannot find crtendS.o: No such file or directory
      /opt/fsl-imx-wayland/6.6-scarthgap-imx-full-image/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/13.3.0/ld: cannot find crtn.o: No such file or directory
      collect2: error: ld returned 1 exit status
      ninja: build stopped: subcommand failed.
    

    Any ideas why the compiler is failing - and how to solve it?

    J 1 Reply Last reply 16 Dec 2024, 14:49
    0
    • H HenrikZ
      16 Dec 2024, 14:46

      When configuring the "Build & Run" for an Arm cortex A7 processor, the CXX compiler is failing even before it has tried to compile the actual project (it seems that Qt creator might have a small piece of code to confirm, that the settings for compiler works). The questions is, what can cause the CXX compiler to fail in CMakeTestCXXCompiler.cmake (line 70 -> if(NOT CMAKE_CXX_COMPILER_WORKS))
      The CXX compiler that the error is referring to is defined under build environment as:

      CXX="arm-poky-linux-gnueabi-g++  -mthumb -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7 -fstack-protector-strong  -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 --sysroot=$SDKTARGETSYSROOT"
      

      I have tried to compile a very simple program outside Qt Creator (in the terminal) using the above settings for the compiler, and it produces an output file without any problems. When compiled from Qt Creator, I get the following issues:

      /opt/fsl-imx-wayland/6.6-scarthgap-imx-full-image/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++"
      
      is not able to compile a simple test program.
      
      It fails with the following output:
      
        Change Dir: '/home/sm/development_HZ/GreetingsMCU/build/iMX7ULP_KIT-Debug/CMakeFiles/CMakeScratch/TryCompile-9OLwoV'
      
        Run Build Command(s): /usr/bin/ninja -v cmTC_ec202
        [1/2] /opt/fsl-imx-wayland/6.6-scarthgap-imx-full-image/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++   -DQT_QML_DEBUG  -fdiagnostics-color=always -o CMakeFiles/cmTC_ec202.dir/testCXXCompiler.cxx.o -c /home/sm/development_HZ/GreetingsMCU/build/iMX7ULP_KIT-Debug/CMakeFiles/CMakeScratch/TryCompile-9OLwoV/testCXXCompiler.cxx
        [2/2] : && /opt/fsl-imx-wayland/6.6-scarthgap-imx-full-image/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++ -DQT_QML_DEBUG  CMakeFiles/cmTC_ec202.dir/testCXXCompiler.cxx.o -o cmTC_ec202   && :
        FAILED: cmTC_ec202
        : && /opt/fsl-imx-wayland/6.6-scarthgap-imx-full-image/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++ -DQT_QML_DEBUG  CMakeFiles/cmTC_ec202.dir/testCXXCompiler.cxx.o -o cmTC_ec202   && :
        /opt/fsl-imx-wayland/6.6-scarthgap-imx-full-image/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/13.3.0/ld: cannot find Scrt1.o: No such file or directory
        /opt/fsl-imx-wayland/6.6-scarthgap-imx-full-image/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/13.3.0/ld: cannot find crti.o: No such file or directory
        /opt/fsl-imx-wayland/6.6-scarthgap-imx-full-image/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/13.3.0/ld: cannot find crtbeginS.o: No such file or directory
        /opt/fsl-imx-wayland/6.6-scarthgap-imx-full-image/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/13.3.0/ld: cannot find -lstdc++: No such file or directory
        /opt/fsl-imx-wayland/6.6-scarthgap-imx-full-image/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/13.3.0/ld: cannot find -lm: No such file or directory
        /opt/fsl-imx-wayland/6.6-scarthgap-imx-full-image/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/13.3.0/ld: cannot find -lgcc_s: No such file or directory
        /opt/fsl-imx-wayland/6.6-scarthgap-imx-full-image/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/13.3.0/ld: cannot find -lgcc: No such file or directory
        /opt/fsl-imx-wayland/6.6-scarthgap-imx-full-image/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/13.3.0/ld: cannot find -lc: No such file or directory
        /opt/fsl-imx-wayland/6.6-scarthgap-imx-full-image/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/13.3.0/ld: cannot find -lgcc_s: No such file or directory
        /opt/fsl-imx-wayland/6.6-scarthgap-imx-full-image/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/13.3.0/ld: cannot find -lgcc: No such file or directory
        /opt/fsl-imx-wayland/6.6-scarthgap-imx-full-image/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/13.3.0/ld: cannot find crtendS.o: No such file or directory
        /opt/fsl-imx-wayland/6.6-scarthgap-imx-full-image/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/13.3.0/ld: cannot find crtn.o: No such file or directory
        collect2: error: ld returned 1 exit status
        ninja: build stopped: subcommand failed.
      

      Any ideas why the compiler is failing - and how to solve it?

      J Online
      J Online
      jsulm
      Lifetime Qt Champion
      wrote on 16 Dec 2024, 14:49 last edited by
      #2

      @HenrikZ Linker is failing, not compiler.
      Linker is failing because it can't find libraries.
      Is your sysroot properly set up?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • H Offline
        H Offline
        HenrikZ
        wrote on 16 Dec 2024, 15:24 last edited by
        #3

        Hi @jsulm
        Thanks for you response :-)

        I think i have setup the sysroot correctly. In the "Preferences" -> "Kits" and under the Sysroot, i have defined:
        /opt/fsl-imx-wayland/6.6-scarthgap-imx-full-image/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi

        1 Reply Last reply
        0

        2/3

        16 Dec 2024, 14:49

        • Login

        • Login or register to search.
        2 out of 3
        • First post
          2/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved