Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. CMake Does Not Configure Correctly When Cross Compiling

CMake Does Not Configure Correctly When Cross Compiling

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
5 Posts 2 Posters 1.8k 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.
  • J Offline
    J Offline
    jonenz
    wrote on last edited by jonenz
    #1

    Host: Ubuntu 20.04.3 LTS
    Target Sysroot: Raspberry Pi 4 Model B with Raspberry Pi OS Lite
    Qt Creator Version: 4.11.0
    Qt Version: 5.12.11 LTS
    CMake Version: 3.16.3

    I'm attempting to follow this guide to setup a development environment for the Raspberry Pi. When creating a project using New Project --> Application --> Qt Quick Application - Empty, the project compiles correctly and I am able to deploy it when building with qmake, but CMake gives me the following error.

    Running /usr/bin/cmake /home/jon/TestEmpty '-GCodeBlocks - Unix Makefiles' in /home/jon/build-TestEmpty-RaspberryPi-Debug.
    CMake Error at /home/jon/raspberrypi/sysroot/usr/lib/arm-linux-gnueabihf/cmake/Qt5Core/Qt5CoreConfig.cmake:27 (message):
      The imported target "Qt5::Core" references the file
    
         "/home/jon/raspberrypi/sysroot/usr/lib/arm-linux-gnueabihf/qt5/bin/qmake"
    
      but this file does not exist.  Possible reasons include:
    
      * The file was deleted, renamed, or moved to another location.
    
      * An install or uninstall procedure did not complete successfully.
    
      * The installation package was faulty and contained
    
         "/home/jon/raspberrypi/sysroot/usr/lib/arm-linux-gnueabihf/cmake/Qt5Core/Qt5CoreConfigExtras.cmake"
    
      but not all the files it references.
    
    Call Stack (most recent call first):
      /home/jon/raspberrypi/sysroot/usr/lib/arm-linux-gnueabihf/cmake/Qt5Core/Qt5CoreConfigExtras.cmake:6 (_qt5_Core_check_file_exists)
      /home/jon/raspberrypi/sysroot/usr/lib/arm-linux-gnueabihf/cmake/Qt5Core/Qt5CoreConfig.cmake:183 (include)
      /home/jon/raspberrypi/sysroot/usr/lib/arm-linux-gnueabihf/cmake/Qt5/Qt5Config.cmake:28 (find_package)
      CMakeLists.txt:30 (find_package)
    
    
    -- Configuring incomplete, errors occurred!
    See also "/home/jon/build-TestEmpty-RaspberryPi-Debug/CMakeFiles/CMakeOutput.log".
    CMake process exited with exit code 1.
    

    In the build settings for the Raspberry Pi kit I also see that Invalid codemodel file generated by CMake is displayed and no CMake variables are being set. This is not the case for the Desktop kit which builds and runs correctly. The kit is defined as follows:
    PiKit.PNG

    The cross compiled Qt seems to be installed correctly, so I don't understand why the configuration is searching the sysroot for qmake instead of /home/jon/raspberrypi/qt5/bin/qmake.
    QtVersion.PNG

    Does anyone know what may be missing from this configuration?

    1 Reply Last reply
    0
    • JoeCFDJ Offline
      JoeCFDJ Offline
      JoeCFD
      wrote on last edited by
      #2

      On Qt Version Tab, you select Qt(RaspbeeryPi) and then click Apply&OK. It will do it. The system one is ahead your Qt one in the system path.

      /home/jon/raspbrrypi is a not a good location for installation since it is user dependent and therefore bad for deployment and team work. It is better to install it under /opt/raspbrrypi

      J 1 Reply Last reply
      0
      • JoeCFDJ JoeCFD

        On Qt Version Tab, you select Qt(RaspbeeryPi) and then click Apply&OK. It will do it. The system one is ahead your Qt one in the system path.

        /home/jon/raspbrrypi is a not a good location for installation since it is user dependent and therefore bad for deployment and team work. It is better to install it under /opt/raspbrrypi

        J Offline
        J Offline
        jonenz
        wrote on last edited by jonenz
        #3

        @JoeCFD

        That seemed to do the trick. I'm not completely sure what it or why that mattered since the correct version is specified in the kit, but that issue seems to be resolved. It's correctly generating build settings with CMake variables defined.

        Good point regarding the installation location. I will move it once things are working.

        1 Reply Last reply
        0
        • J Offline
          J Offline
          jonenz
          wrote on last edited by jonenz
          #4

          @JoeCFD 's suggestion seems to clear up the configuration trouble.

          Running /usr/bin/cmake /home/jon/TestEmpty '-GCodeBlocks - Unix Makefiles' -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_CXX_COMPILER:STRING=/usr/bin/arm-linux-gnueabihf-g++ '-DCMAKE_CXX_COMPILER_TARGET :STRING=arm-linux-gnueabihf' -DCMAKE_C_COMPILER:STRING=/usr/bin/arm-linux-gnueabihf-gcc -DCMAKE_C_COMPILER_TARGET:STRING=arm-linux-gnueabihf -DCMAKE_PREFIX_PATH:STRING=/home/jon/raspberrypi/qt5pi -DCMAKE_SYSROOT:STRING=/home/jon/raspberrypi/sysroot -DQT_QMAKE_EXECUTABLE:STRING=/home/jon/raspberrypi/qt5/bin/qmake in /home/jon/build-TestEmpty-RaspberryPi-Debug.
          -- The CXX compiler identification is GNU 9.3.0
          -- Check for working CXX compiler: /usr/bin/arm-linux-gnueabihf-g++
          -- Check for working CXX compiler: /usr/bin/arm-linux-gnueabihf-g++ -- works
          -- Detecting CXX compiler ABI info
          -- Detecting CXX compiler ABI info - done
          -- Detecting CXX compile features
          -- Detecting CXX compile features - done
          -- Configuring done
          -- Generating done
          CMake Warning:
            Manually-specified variables were not used by the project:
          
              CMAKE_CXX_COMPILER_TARGET 
              CMAKE_C_COMPILER
              QT_QMAKE_EXECUTABLE
          
          
          -- Build files have been written to: /home/jon/build-TestEmpty-RaspberryPi-Debug
          

          However, now I'm now getting a linker error.

          15:38:08: Running steps for project TestEmpty...
          15:38:08: Starting: "/usr/bin/cmake" --build . --target all
          Scanning dependencies of target TestEmpty_autogen
          [ 16%] Automatic MOC and UIC for target TestEmpty
          [ 16%] Built target TestEmpty_autogen
          [ 33%] Automatic RCC for qml.qrc
          Scanning dependencies of target TestEmpty
          [ 50%] Building CXX object CMakeFiles/TestEmpty.dir/TestEmpty_autogen/mocs_compilation.cpp.o
          [ 66%] Building CXX object CMakeFiles/TestEmpty.dir/main.cpp.o
          [ 83%] Building CXX object CMakeFiles/TestEmpty.dir/TestEmpty_autogen/EWIEGA46WW/qrc_qml.cpp.o
          [100%] Linking CXX executable TestEmpty
          /usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: /home/jon/raspberrypi/sysroot/lib/arm-linux-gnueabihf/libpthread.so.0: undefined reference to `__nanosleep_nocancel@GLIBC_PRIVATE'
          /usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: /home/jon/raspberrypi/sysroot/lib/arm-linux-gnueabihf/libpthread.so.0: undefined reference to `__libc_vfork@GLIBC_PRIVATE'
          /usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: /home/jon/raspberrypi/sysroot/lib/arm-linux-gnueabihf/libpthread.so.0: undefined reference to `__pause_nocancel@GLIBC_PRIVATE'
          collect2: error: ld returned 1 exit status
          make[2]: *** [CMakeFiles/TestEmpty.dir/build.make:126: TestEmpty] Error 1
          make[1]: *** [CMakeFiles/Makefile2:77: CMakeFiles/TestEmpty.dir/all] Error 2
          make: *** [Makefile:84: all] Error 2
          15:38:10: The process "/usr/bin/cmake" exited with code 2.
          Error while building/deploying project TestEmpty (kit: RaspberryPi)
          When executing step "CMake Build"
          15:38:10: Elapsed time: 00:01.
          

          Looking at the symbols with nm shows that they are undefined and makes me think there is a problem with the sysroot, but I don't understand why the build then works with qmake.

          ~$ nm -gD raspberrypi/sysroot/lib/arm-linux-gnueabihf/libpthread.so.0 | grep nanosleep
          00011adc T __nanosleep
                   U __nanosleep_nocancel
          00011adc W nanosleep
          
          ~$ nm -gD raspberrypi/sysroot/lib/arm-linux-gnueabihf/libpthread.so.0 | grep libc_vfork
                   U __libc_vfork
          
          ~$ nm -gD raspberrypi/sysroot/lib/arm-linux-gnueabihf/libpthread.so.0 | grep pause_nocancel
                   U __pause_nocancel
          

          Please share if you have any ideas.

          1 Reply Last reply
          0
          • JoeCFDJ Offline
            JoeCFDJ Offline
            JoeCFD
            wrote on last edited by JoeCFD
            #5

            https://forums.gentoo.org/viewtopic-t-1118830-start-0.html

            1 Reply Last reply
            0

            • Login

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