Cross-compiling a static binary from GitHub Actions

Jacob Carlborg doob at me.com
Sun Sep 26 16:30:04 UTC 2021


On Saturday, 25 September 2021 at 07:59:08 UTC, Vladimir 
Panteleev wrote:
> Hi,
> My goal: build a static binary of a D program for Linux-AArch64 
> from GitHub Actions (as an artifact).
>
> Does anyone have any advice in this direction?

I'm using an approach were I'm cross-compiling on the host and 
then link and run the tests in a Docker container with the help 
of QEMU:

https://github.com/jacob-carlborg/lime/blob/f3f0b5580b06568aeff38987148729dd4b4a3797/.github/workflows/ci.yml#L156-L172

Docker has great integration with QEMU, just specify the 
`--platform` flag when running a container.

Another approach would be to use Zig to cross-link. It supports 
automatically compiling the C standard library (glibc or musl) 
for its supported architectures. No need to install anything 
besides downloading Zig.

--
/Jacob Carlborg


More information about the digitalmars-d-ldc mailing list