I have no idea what QEMU issues cause those errors, but I can attest to cross-compilation working well. It would be pretty easy to cross-compile Swift packages to linux AArch64 from one of the other supported platforms, as you only need four things:
- One of the prebuilt toolchains from swift.org, which you presumably already have
- A glibc sysroot for linux aarch64, which can be downloaded from one of the distros
- A Swift resource directory for linux aarch64, which you can get by downloading the closest AArch64 toolchain to your target distro from the swift.org download link in 1. and extracting the
usr/lib/swift/
directory from - A cross-compilation destination file, which stitches together these three requirements into a cross-compilation toolchain: take a look at the one I use for Android AArch64 as an example (the
sdk
is the path to the glibc sysroot from 2. and the-resource-dir
is the Swift resource directory from 3., no need for the-L
link line I added in your case)
You will also need to modify the symbolic link usr/lib/swift/clang
in the Swift resource directory to point at the clang resource directory in the Swift toolchain you are using, as shown in my Android README doc. Use something like the SwiftPM command shown in that doc to cross-compile Swift packages for linux AArch64.