Cross-compiling a static binary from GitHub Actions

Vladimir Panteleev thecybershadow.lists at gmail.com
Sat Sep 25 18:08:44 UTC 2021


On Saturday, 25 September 2021 at 16:35:33 UTC, kinke wrote:
> According to 
> https://packages.ubuntu.com/bionic/arm64/libtinfo-dev/filelist, 
> the static libs are probably generally available. So something 
> like
> ```
> dpkg --add-architecture arm64
> apt-get update
> apt-get install libtinfo-dev:arm64
> ```
> might be sufficient to make them available for the 
> gcc-aarch64-linux-gnu toolchain as well.

That looked promising so I tried it out.

Ubuntu seems to require some non-trivial edits to 
/etc/apt/sources.list in order to add arm64, so I proceeded with 
Debian.

On Bullseye, I got linking errors with undefined references to 
'deflateInit2_', and no matter how I tried to add libz they 
wouldn't go away, so I proceeded with Buster.

The Dub version packaged in Buster is too old and doesn't work 
any more, so I used the installation script from the website to 
install ldc+dub.

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.

Say, shouldn't it be using lld anyway? I tried installing lld, 
but that didn't work because it didn't match the LLVM version in 
ldc.

Here is what I have:
https://github.com/CyberShadow/btdu/tree/next/release



More information about the digitalmars-d-ldc mailing list