Cross-compiling a static binary from GitHub Actions

kinke noone at nowhere.com
Sat Sep 25 20:12:09 UTC 2021


On Saturday, 25 September 2021 at 18:08:44 UTC, Vladimir 
Panteleev wrote:
> This gets me to a point where I can build the x86_64 binary. 
> But, if I try "-mtriple arm64-linux-gnu", I get 
> "/usr/bin/ld.gold: fatal error: btdu-static-arm64.o: 
> unsupported ELF machine number 183". Not sure how to proceed 
> from here, fiddled with --linker but couldn't get anything to 
> work.

I assume you've skipped the 
https://wiki.dlang.org/Cross-compiling_with_LDC#Tweaking_the_LDC_configuration_file part and expect passing -mtriple to be sufficient for linking as well. In that case, read that section again - you'll need to pass `-gcc=aarch64-linux-gnu-gcc` for LDC to invoke the cross-gcc as linker driver. *And* specify the AArch64 druntime/Phobos dir via `-L` (but the linker might still complain about the x64 libs dir specified in the default ldc2.conf section). [`ldc2 -v` shows the linker cmdline for troubleshooting.]



More information about the digitalmars-d-ldc mailing list