Skip to content

Add --host-arch and --target-arch, and 'host-arches' conditional

This command adds initial cross-compilation support to BuildStream.

It has been tested against a converted version of the Baserock compiler bootstrap and used to cross build sysroots for armv8l64 and ppc64l from an x86_64 host.

For example, to build a sysroot for ARM v8 64-bit you can do this:

bst build --target-arch=armv8b64 gnu-toolchain/stage2.bst

This would cause the adapted Baserock definitions to produce a stage1 simple cross compiler that runs on the native architecture and produces armv8b64 binaries, and then cross build a stage2 sysroot that executes on armv8b64.

Currently the --arch and --host-arch options do nothing of use with respect to cross-compilation.

Elements have 2 new variables available, %{bst-host-arch} and %{bst-target-arch}. The 'arches' conditional now follows %{bst-target-arch}, while the new 'host-arches' conditional follows %{bst-host-arch}. All of --arch, --host-arch and --target-arch default to the output of uname -a.

There's no magic here that would make all BuildStream elements suddenly able to cross compile. It is up to an individual element to support this by honouring %{bst-target-arch} in whatever way makes sense.

Merge request reports