Is it possible to make an AppImage of a cross-compiled application?

Hello everyone!

I’ve set up an environment for creating arm64 Linux binaries on an x86-64 host. This is simply Ubuntu amd64, configured for multiarch (dpkg --add-architecture arm64 and all that stuff.) Installing the libraries needed is done with:

apt-get install qtbase5-dev:arm64 libmpg123-dev:arm64 [etc...]

This installs the arm64 binaries of the libraries. Then I build by Qt application with:

aarch64-linux-gnu-qmake
make -j`nproc`

And I get a arm64 build of my application. Question now is, how on earth do I make an AppImage for it? If I try something like:

ARCH=arm_aarch64 linuxdeployqt \
    AppDir/usr/share/applications/nikos.chantziaras.qtads.desktop \
    -qmake=aarch64-linux-gnu-qmake

(linuxdeployqt is just a renamed linuxdeployqt-continuous-x86_64.AppImage.)

Then I get errors:

linuxdeployqt  (commit aeafcd2), build 13 built on 2022-01-28 22:37:07 UTC
Desktop file as first argument: "AppDir/usr/share/applications/nikos.chantziaras.qtads.desktop"
desktopExecEntry: "qtads"
desktopIconEntry: "qtads"
Found binary from desktop file: "/qtads/build/AppDir/usr/bin/qtads"
FHS-like mode with PREFIX, fhsPrefix: "/qtads/build/AppDir/usr"
app-binary: "/qtads/build/AppDir/usr/bin/qtads"
appDirPath: "/qtads/build/AppDir"
relativeBinPath: "usr/bin/qtads"
Copied "AppDir/usr/share/applications/nikos.chantziaras.qtads.desktop" to "/qtads/build/AppDir/nikos.chantziaras.qtads.desktop"
Found icons from desktop file: ("/qtads/build/AppDir/usr/share/icons/hicolor/256x256/apps/qtads.png", "/qtads/build/AppDir/usr/share/icons/hicolor/72x72/apps/qtads.png", "/qtads/build/AppDir/usr/share/icons/hicolor/48x48/apps/qtads.png")
iconToBeUsed: "/qtads/build/AppDir/usr/share/icons/hicolor/48x48/apps/qtads.png"
Copied "/qtads/build/AppDir/usr/share/icons/hicolor/48x48/apps/qtads.png" to "/qtads/build/AppDir/qtads.png"
ERROR: findDependencyInfo: ""
ERROR: findDependencyInfo: ""
WARNING: Could not find any external Qt libraries to deploy in "/qtads/build/AppDir"
WARNING: Perhaps linuxdeployqt was already used on "/qtads/build/AppDir" ?
WARNING: If so, you will need to rebuild "/qtads/build/AppDir" before trying again.
WARNING: Or ldd does not find the external Qt libraries but sees the system ones.
WARNING: If so, you will need to set LD_LIBRARY_PATH to the directory containing the external Qt libraries before trying again.
WARNING: FIXME: https://github.com/probonopd/linuxdeployqt/issues/2

Setting LD_LIBRARY_PATH to /usr/lib/aarch64-linux-gnu does not change anything.

While it is totally possible to make an AppImage of a cross-compiled application (after all, an AppImage is just a self-mounting disk image that executes whatever the author has put inside it), linuxdeployqt cannot do it. You would need to use other tools to produce the AppImage.

Here are some AppImage generation tools. I don’t know which ones support this use case; best try or ask beforehand.

Thanks!

I’ve now set up a CI on CircleCI which provides ARM servers and build and generate the AppImage there.

Another solution that avoids “the cloud” and does local builds instead (I prefer them, since I have trust issues with generating release binaries on machines I don’t own) would have been to build using QEMU to run an Ubuntu 16.04 ARM64 container, but unfortunately ldd fails in such setup and thus linuxdeployqt can’t work (it works with 18.04, but I’d like to build on 16.04 for now.)