This feature is still experimental; some aspects may not work fully or at all just yet. Proceed with caution!
From v12.2 onwards, Please has limited cross-compiling support. This allows you to
instruct it to build outputs for other architectures alongside the host architecture.
This is triggered by passing the
--arch flag when invoking plz.
The outputs from a cross-compiled build will be in a directory under plz-out prefixed
with the architecture - e.g.
When compiling a target for a different binary, the BUILD file will be re-parsed for it.
CONFIG.OS properties will update appropriately,
which is necessary for some rules to work correctly. Similarly, when the rule builds, the
ARCH environment variables will be set to the target architecture
for that build target.
The distinction between
extremely important when cross-compiling.
srcs always match the architecture
of the target, as do
deps unless explicitly requested (e.g. by prefixing with
the required arch, as in
tools always use the host architecture since they are executed on
the host during the build.
The config file for any target architecture is read
(if present) and applied for targets compiling for that architecture - i.e.
.plzconfig_linux_x86 etc. Typically you will need to create this file and
modify appropriate settings for compiler flags etc.
Architectures are currently always two-part tags in a similar format to Go's - i.e.
linux_amd64 etc. These are passed in as a single flag but decomposed into
separate OS and architecture parts for later operations. You can request whatever architecture
you want, but obviously the build will probably not succeed unless you have tools set up etc.
The various builtin languages have differing levels of support. Currently they are as follows:
GOOS="linux" GOARCH="386" go install -i std.
native = Truewill download for the target architecture.