Monday, 31 October 2016

Flatpak cross-compilation support: Epilogue

You might remember my attempts at getting an easy to use cross-compilation for ARM applications on my x86-64 desktop machine.

With Fedora 25 approaching, I'm happy to say that the necessary changes to integrate the feature have now rolled into Fedora 25.

For example, to compile the GNU Hello Flatpak for ARM, you would run:

$ flatpak install gnome org.freedesktop.Platform/arm org.freedesktop.Sdk/arm
Installing: org.freedesktop.Platform/arm/1.4 from gnome
[...]
$ sudo dnf install -y qemu-user-static
[...]
$ TARGET=arm ./build.sh

For other applications, add the --arch=arm argument to the flatpak-builder command-line.

This example also works for 64-bit ARM with the architecture name aarch64.

3 comments:

Dan Nicholson said...

How does this work exactly? I did some hacks using qemu-arm-static for Endless similar to how you mentioned in your previous post. It's working, but I have to mangle a --bind-mount=/run/qemu-arm-static=/usr/bin/qemu-arm-static into our builder manifests (and adjust the binfmt rule to use /run/qemu-arm-static). I don't see anything in flatpak that ensures the qemu binary is available in the sdk at build time.

Bastien Nocera said...

By letting the kernel keep the qemu binary opened. See this article linked from the original article:
https://lwn.net/Articles/682286/

Dan Nicholson said...

Perfect, thanks.