QT5 Crosscompile MX8MP Yocto

  • Hello,

    i'm looking for the Crosscompile QT-Version(qmake) path in the Yocto Build.


    The "F&S Introduction to QT5 Debugging an Application Version 1.4" document describes everything for Buildroot. But the "F&S i.MX8M-Plus Linux First Steps Version 1.0" document states that "Buildroot Release is not yet available."

    So the Yocto-Build is a "fus-image-qt5"(fus-imx-wayland).

    Thank you.

    With best regards
    Benni

  • Hello,

    thank you for updating the manual.

    The commands that are mentioned on page 7
    "...<build-directory>]$ source ./..sources/poky/oe-init-build-env
    ...<build-directory>]$ bitbake meta-toolchain"

    didn't work for me.
    QT wasn't compiled with that.

    With the configured Yocto i used the command
    "bitbake meta-toolchain-qt5"


    Best regards

    Benni

  • Hi,


    I just came across this post, and I'd like to point out, that the commands also did not work for me (as it is still written in the Doc-File F&S Introduction to QT Debugging an Application v.1.11).

    Code
    1. $ source ./../sources/poky/oe-init-build-env
    2. $ bitbake meta-toolchain-qt6

    Instead, I did:

    Code
    1. $ cd fsimx6-Y2024.04/build/yocto-fus
    2. $ source ./setup-environment build-fsimx6-fus-imx-wayland/
    3. $ bitbake meta-toolchain-qt6

    This seems to work fine (Qt and all Qt packages were built).


    ------


    I'd kindly like to ask another question, related to the documentary pointed out earlier.

    After building the toolkit and running the bash script in /tmp/deploy/sdk, the documentation guides me to do:


    "After that you have to install the new root filesystem on your remote target system." (p. 10)


    I am unsure, what it means. I have built a fus-image-qt6 earlier and flashed it to my efusa9r2q.

    After running the bash script, the toolchain was installed to /opt/fus-imx-wayland/5.15-kirkstone. However, the images and build files in /tmp/deploy/images/fsimx6/ remained untouched.


    Should I bitbake the qt6-image again, after installation of the toolchain?


    Thanks!

  • Hi,


    thank you for your quick response.


    So, I followed the steps in the doc, and I successfully deployed two Qt applications on the board, one QtQUick and one QtWidgets application. The board runs on the fus-image-qt6 example image.


    I indeed did install an additional library in the VM (QSerialPort), but it is not used for the example applications I try to test the remote debugging with.


    However, when running it (either from the VM via SSH, or directly on the board), the program crashes with the error:


    Code
    1. /home/root/qt-widgets-test: error while loading shared libraries: libQt6Widgets.so.6: cannot open shared object file: No such file or directory

    The same with the QtQuick app:

    Code
    1. /home/root/qt-quick-test: error while loading shared libraries: libQt6Quick.so.6: cannot open shared object file: No such file or directory


    I guess, this is due to missing libraries on the board, which I assumed were present after building and deploying the fus-image-qt6 example image.

  • Hiya,


    I have built a core-image-base image, and included the following lines to my conf/local.conf file:

    Code
    1. # Add opennssh to the build
    2. EXTRA_IMAGE_FEATURES ?= "debug-tweaks ssh-server-openssh"
    3. # Install Qt Base and Wayland, if necessary (e.g., when building core-image-base)
    4. DISTRO_FEATURES:append = "wayland"
    5. IMAGE_INSTALL:append = " qtbase qtwayland"
    6. CORE_IMAGE_EXTRA_INSTALL += "wayland weston"
    7. # Remove X11 from Build (e.g., if Wayland is to be used)
    8. DISTRO_FEATURES:remove = "x11"


    This works just fine, now. I can deploy and run Qt Widgets and Qt Quick applications via SSH on the target!


    ------------------


    The two applications I tested successfully were built with qmake. However, if I try to deploy and run an application which is being built by CMake, it fails with the following errors:

    Code
    1. /opt/fus-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/share/cmake-3.22/Modules/CMakeTestCXXCompiler.cmake:62: error: The C++ compiler "/opt/fus-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux/arm-poky-linux-g++" is not able to compile a simple test program. It fails with the following output: Change Dir: /home/developer/Stash/build-qt6-toolchain-test-FS_Cross_Compile_Kit-Debug/CMakeFiles/CMakeTmp Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_a17b9/fast && /usr/bin/gmake -f CMakeFiles/cmTC_a17b9.dir/build.make CMakeFiles/cmTC_a17b9.dir/build gmake[1]: Entering directory '/home/developer/Stash/build-qt6-toolchain-test-FS_Cross_Compile_Kit-Debug/CMakeFiles/CMakeTmp' Building CXX object CMakeFiles/cmTC_a17b9.dir/testCXXCompiler.cxx.o /opt/fus-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux/arm-poky-linux-g++ -o CMakeFiles/cmTC_a17b9.dir/testCXXCompiler.cxx.o -c /home/developer/Stash/build-qt6-toolchain-test-FS_Cross_Compile_Kit-Debug/CMakeFiles/CMakeTmp/testCXXCompiler.cxx Linking CXX executable cmTC_a17b9 /opt/fus-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_a17b9.dir/link.txt --verbose=1 /opt/fus-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux/arm-poky-linux-g++ CMakeFiles/cmTC_a17b9.dir/testCXXCompiler.cxx.o -o cmTC_a17b9 /opt/fus-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.4.0/ld: cannot find Scrt1.o: No such file or directory /opt/fus-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.4.0/ld: cannot find crti.o: No such file or directory /opt/fus-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.4.0/ld: cannot find crtbeginS.o: No such file or directory /opt/fus-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.4.0/ld: cannot find -lstdc++: No such file or directory /opt/fus-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.4.0/ld: cannot find -lm: No such file or directory /opt/fus-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.4.0/ld: cannot find -lgcc_s: No such file or directory /opt/fus-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.4.0/ld: cannot find -lgcc: No such file or directory /opt/fus-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.4.0/ld: cannot find -lc: No such file or directory /opt/fus-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.4.0/ld: cannot find -lgcc_s: No such file or directory /opt/fus-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.4.0/ld: cannot find -lgcc: No such file or directory /opt/fus-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.4.0/ld: cannot find crtendS.o: No such file or directory /opt/fus-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/11.4.0/ld: cannot find crtn.o: No such file or directory collect2: error: ld returned 1 exit status gmake[1]: *** [CMakeFiles/cmTC_a17b9.dir/build.make:99: cmTC_a17b9] Error 1 gmake[1]: Leaving directory '/home/developer/Stash/build-qt6-toolchain-test-FS_Cross_Compile_Kit-Debug/CMakeFiles/CMakeTmp' gmake: *** [Makefile:127: cmTC_a17b9/fast] Error 2
    Code
    1. :-1: error: CMake process exited with exit code 1.
    Code
    1. :-1: error: No CMake configuration found!


    Is there a way to also run and debug CMake-built applications using the Kit described in the Documentation via SSH?



  • Good morning,


    yes, I have set up the Kit (Qt Version, compiler, debugger, cmake) as stated in the documentary, pointing to the SDK in /opt/fus-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/.


    I could get rid of the errors I posted before, by setting the CMAKE_SYSROOT variable.

    Code
    1. set(CMAKE_SYSROOT /opt/fus-imx-wayland/5.15-kirkstone/sysroots/cortexa9t2hf-neon-poky-linux-gnueabi)

    Furthermore, I explicitly set the target architecture and FPU (floating point unit), since I experienced errors stating, that the FPU for the target was not set:

    Code
    1. set(CMAKE_C_FLAGS "--sysroot=${CMAKE_SYSROOT} -march=armv7-a -mtune=cortex-a9 -mfpu=vfpv3-d16 -mfloat-abi=hard")
    2. set(CMAKE_CXX_FLAGS "--sysroot=${CMAKE_SYSROOT} -march=armv7-a -mtune=cortex-a9 -mfpu=vfpv3-d16 -mfloat-abi=hard")

    Just to make sure, I also specified the installation directory on the target conditionally, just as it is suggested to do in a .pro-file, if qmake is used

    Code
    1. # Set installation directory conditionally
    2. if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
    3. set(INSTALL_DIRECTORY /home/root)#
    4. endif()
    5. # Install the target
    6. install(TARGETS appqt6-cmake-test DESTINATION ${INSTALL_DIRECTORY})

    However, the error I see after adjusting these settings in my CMakeLists.txt file, are now of a nature of missing dependencies, I assume. I have attached the error output to this post.


    The line, the error message points to in CMakeLists.txt:10, reads:

    Code
    1. find_package(Qt6 6.2 COMPONENTS Quick REQUIRED)


    In the attached cmake error output, the lines


    • Line 40: CMake Warning at /opt/fus-imx-wayland/5.15-kirkstone/sysroots/x86_64-pokysdk-linux/usr/share/cmake-3.22/Modules/CMakeFindDependencyMacro.cmake:47 (find_package):
      Found package configuration file:
      /opt/fus-imx-wayland/5.15-kirkstone/sysroots/cortexa9t2hf-neon-poky-linux-gnueabi/usr/lib/cmake/Qt6Core/Qt6CoreConfig.cmake
      but it set Qt6Core_FOUND to FALSE so package "Qt6Core" is considered to be NOT FOUND.
    • Line 55: CMake Warning at /opt/fus-imx-wayland/5.15-kirkstone/sysroots/cortexa9t2hf-neon-poky-linux-gnueabi/usr/lib/cmake/Qt6/Qt6Config.cmake:223 (find_package):
      Found package configuration file:
      /opt/fus-imx-wayland/5.15-kirkstone/sysroots/cortexa9t2hf-neon-poky-linux-gnueabi/usr/lib/cmake/Qt6Quick/Qt6QuickConfig.cmake
      but it set Qt6Quick_FOUND to FALSE so package "Qt6Quick" is considered to be NOT FOUND.

    make me suspecting, there is some sort of misconfiguration of CMake, not finding the QtCore and QtQuick packages.


    I checked, the Qt6CoreConfig.cmake and Qt6QuickConfig.cmake files are located at the correct path.


    I checked the Qt6Config.cmake at line 223 (first error in call stacks), and it failes at the find_package command.


    I will investigate further today, but any hints, tips or black magic will be helpful!


    Cheers.