Cross-compiling a flatpak

Christian Hergert christian at hergert.me
Fri Mar 23 21:59:34 UTC 2018


On 03/23/2018 12:35 AM, Alexander Larsson wrote:
> This will use the userspace qemu emulation to just run the aarch64
> binaries. This works surprisingly well, but obviously it is a bit slow
> to run the compiler emulated. Christian recently proposed a minor
> extension of this model where we keep the aarch64 basic runtime, but
> replace/add a few strategic binaries with x86-64 versions.

First off, thanks Corentin for starting the discussion!

Relying on qemu-user-static for binary-translation is a great "worst
case", but most definitely a terrible "best-case". This is becoming
increasingly important for Builder as flatpak+aarch64 is going to get a
lot of new users in the upcoming months.

I think we want to continue to use the cross-architecture runtime with
qemu-user-static but then add SDK extensions for the native
cross-compiler. That has the benefit of continuing to work should we
come across things we didn't think about cross-compiling.

So if I'm on x86_64, building for aarch64, I'd like to see:

 - use org.gnome.Sdk/aarch64/3.28 as the SDK used for the build. This
   ensures anything w/o a native alternative runs under qemu.
 - a new org.gnome.Sdk.aarch64/x86_64/3.28 SDK extension that
   places cross-compiler and associated core utils in a location
   specified with "prepend-path".

This would allow Builder's flatpak plugin to look at the architecture of
the device we're building + SDK identifier to automatically wire up an
available cross-compiler.

If "prepend-path" is used (do we only have "append-path" currently?),
then basically no changes are required to the application to get a
faster build containing the "same" output.

The thing I specifically want to avoid, is the disaster that is
cross-architecture development with sysroots/toolchains on a host and
making the developer choose which to use. We have enough information
about the build that we should be able to avoid that rats nest altogether.

-- Christian


More information about the Flatpak mailing list