Cross-compiling a static binary from GitHub Actions

kinke noone at nowhere.com
Sat Sep 25 16:12:52 UTC 2021


On Saturday, 25 September 2021 at 07:59:08 UTC, Vladimir 
Panteleev wrote:
> (I managed to build a static binary for x86_64.)

Linked statically against glibc? I thought that's not really 
possible, and one would need to resort to another libc like musl 
for fully statically linked binaries. Could you link to the repo 
of the tool?

That said, linking dynamically against a rather old glibc seems 
to work in many cases. The official LDC binaries do that and are 
built on Ubuntu 18.04 for that reason; they seem to work on most 
distros, excl. musl-only Alpine. So I'd expect cross-compiling on 
Ubuntu 18 and using its cross-gcc toolchain to work for most 
people.

Another (potentially more flexible) option could be using Travis 
for native AArch64 compilation - again, that's what LDC does 
(https://github.com/ldc-developers/ldc/blob/master/.travis.yml). 
They have a Ubuntu 18.04 image, and the D integration still 
works, on AArch64 too. Their AArch64 service is sponsored by ARM 
and doesn't cost any credits for public open-source projects.


More information about the digitalmars-d-ldc mailing list