Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-122420

meta-qt6 incorrectly packages x86_64 qmake on aarch64 cross-compile target

    XMLWordPrintable

Details

    • Linux/Yocto
    • 762c56d65 (dev), c174f9a5d (dev), 8c46e471d (6.7), bfb6f4e86 (6.7)

    Description

      The version of qmake for the Qt 6.5.3 toolchain that ended up in the Yocto Poky Kirkstone image I built against a {{qemuarm64 }}target cannot be executed since it was compiled for an {{x86_64 }}architecture.  I need a version of {{qmake }}that runs on the {{aarch64 }}ARMv8 target.

      In discussions with the author of the linuxdeploy }}tool and its {{linuxdeploy-qt plugin, he has confirmed that cross-compilation support is not yet available for this toolchain.  Thus, in order to create an AppImage package for my cross-compiled application, the {{linuxdeploy }}toolchain must be run on an {{aarch64 }}ARMv8 target.  {{qmake }}is one of the dependencies of this toolchain.  The ultimate aim is to create an AppImage that I download directly to a hardware device running ARMv8 as a single file deployment that will contain all required dependencies.

      In effect, I am using a QEMU ARMv8 emulator as an extension of my x86_64 build VM in order to produce an artifact that will expand and run on an ARMv8 device where no pre-existing dependencies are required (this is the entire purpose of AppImage distribution).

      I'm running compilers from GNU 11.4.0,

      https://github.com/linuxdeploy/linuxdeploy with its plugin
      https://github.com/linuxdeploy/linuxdeploy-plugin-qt
      with both cloned under their main branch,

      in a QEMU aarch64 environment built from Yocto Poky Kirkstone Linux,

      with the intention of creating AppImages for the CrossCrontrol v700 (i.MX8DualXPlus) and v1200 (i.MX8QuadXPlus) devices which use the aarch64 ARMv8 architecture.

      I have set the following environment variables (as we use a commercial Qt license)
      export QT_EDITION=commercial
      export QT_COMMERCIAL_MODULES=1

      and properly integrated
      https://codereview.qt-project.org/yocto/meta-qt6
      branch 6.5.3
      into my $POKY_ROOT/build/conf/bblayers.conf BBLAYERS variable

      I have the following lines in my $POKY_ROOT/build/conf/local.conf
      that are changed from the stock file:

      IMAGE_INSTALL:append = " sshfs-fuse openssh fuse ldd cmake patchelf git xz ninja jpeg libjpeg-turbo libpng libpng-dev python3 libjpeg-turbo-dev qtbase-tools qtdeclarative-tools"

      EXTRA_IMAGE_FEATURES = "tools-sdk tools-debug debug-tweaks"

       

      I run the command
      {{bitbake core-image-full-cmdline
      }}
      and launched the resulting binary on a QEMU {{aarch64 }}emulator (via nested virtualization) with 8 processors and 2GB RAM and 1G HDD, 

      running on a x86_64 VM with 14 processors, 12G of memory and a 500GB HDD,

      running on an ASUS Tuf F15 laptop with 20 processors, 32G of memory and 3.5TB of SSD storage.  

      I  logged into the QEMU VM just launched and mounted my toolchain directory /home/ccs via sshfs into the instance. 

      I tried to run 
      {{qmake --help
      }}
      and got the following error:
      bash: /home/ccs/Qt/6.6.0/gcc_64/bin/qmake: cannot execute binary file: Exec format error

      After investigation, I see now that the {{qmake }}that was packaged into the {{qemuarch64 }}file system was compiled to the {{x86_64 }}architecture !?!? For some reason the meta-qt6 layer does not respect the
      MACHINE ?= "qemuarm64"
      line I have in my $POKY_ROOT/build/conf/local.conf

      Here are some commands confirming this, run from within the QEMU aarch64 VM:

       

      root@qemuarm64:/home/ccs/Qt/Projects/CortexBuilds/bin# which qmake
      /usr/bin/qmake
      root@qemuarm64:/home/ccs/Qt/Projects/CortexBuilds/bin# cat `which qmake`
      
      #!/bin/sh
      # The directory of this script is the expanded absolute path of the "$qt_prefix/bin" directory.
      script_dir_path=`dirname $0`
      script_dir_path=`(cd "$script_dir_path"; /bin/pwd)`
      /home/ccs/workspaces/git/poky/build/tmp/work/cortexa57-poky-linux/qtbase/6.5.3-r0/recipe-sysroot-native/usr/bin/qmake6 -qtconf "$script_dir_path/target_qt.conf" $*
      
      root@qemuarm64:/home/ccs/Qt/Projects/CortexBuilds/bin# ls /home/ccs/workspaces/git/poky/build/tmp/work/cortexa57-poky-linux/qtbase/6.5.3-r0/recipe-sysroot/usr/bin/qmake 
      
      ls: cannot access '/home/ccs/workspaces/git/poky/build/tmp/work/cortexa57-poky-linux/qtbase/6.5.3-r0/recipe-sysroot/usr/bin/qmake': No such file or directory
      

       

      The "recipe-sysroot-native" is compiled against the x86_64 }}target, and the "{{{}recipe-sysroot" is compiled against the aarch64 target (but qmake }}was not found in the latter directory, only in the former directory).  I do understand that {{qmake }}is required on the {{x86_64 side of the cross-compiler toolchain, I'm just looking for it to also be packaged on the target side, and the file that was packaged into the target side is of the wrong architecture.

      Some details on the QEMU ARMv8 environment I'm running my Yocto Poky Kirkstone Linux image in:

      root@qemuarm64:/home/ccs/Qt/Projects/CortexBuilds/bin# uname -a
      Linux qemuarm64 5.15.124-yocto-standard #1 SMP PREEMPT Thu Aug 3 18:08:15 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux
      
      root@qemuarm64:/home/ccs/Qt/Projects/CortexBuilds/bin# cat /etc/issue
      Poky (Yocto Project Reference Distro) 4.0.16 \n \l
      root@qemuarm64:/home/ccs/Qt/Projects/CortexBuilds/bin#
      

       

       

      I found the qmake }}executable pointed to by the script {{`which qmake` was not even compiled against an {{aarch64 }}target:

      root@qemuarm64:/home/ccs/Qt/Projects/CortexBuilds/bin# file /home/ccs/workspaces/git/poky/build/tmp/work/cortexa57-poky-linux/qtbase/6.5.3-r0/recipe-sysroot-native/usr/bin/qmake6
      
      /home/ccs/workspaces/git/poky/build/tmp/work/cortexa57-poky-linux/qtbase/6.5.3-r0/recipe-sysroot-native/usr/bin/qmake6: ELF 64-bit LSB pie executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter 
      

       

      A few details on the build VM I'm using to build the image:

       

      ccs@ccs-VirtualBox:~/workspaces/git/poky/meta-qt6$ uname -a
      Linux ccs-VirtualBox 5.15.0-92-generic #102~20.04.1-Ubuntu SMP Mon Jan 15 13:09:14 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
      
      ccs@ccs-VirtualBox:~/workspaces/git/poky/meta-qt6$ cat /etc/issue
      Ubuntu 20.04.6 LTS \n \l
       
      

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            sapiippo Samuli Piippo
            myles.dear Arnaud Prati
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes