Cross-compiling a static binary from GitHub Actions

Vladimir Panteleev thecybershadow.lists at gmail.com
Sun Sep 26 07:51:01 UTC 2021


On Saturday, 25 September 2021 at 20:12:09 UTC, kinke wrote:
> 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.]

I can't get `-gcc` to do anything, it always invokes 
`/usr/bin/cc`.

Example with `-v`:

```
/usr/bin/cc btdu-static-aarch64.o -o btdu-static-aarch64 
-fuse-ld=gold -Lrelease -l:libtermcap.a -l:libncursesw.a 
-l:libtinfo.a -l:libz.a 
-L/root/dlang/ldc-1.27.1/bin/../lib-aarch64 -lphobos2-ldc 
-ldruntime-ldc -Wl,--gc-sections -lrt -ldl -lpthread -lm
```

Whether it's specified in the configuration file or on the 
command line doesn't stop it from running `/usr/bin/cc`.

(I didn't configure the library stuff yet)


More information about the digitalmars-d-ldc mailing list