From thecybershadow.lists at gmail.com Tue Dec 23 12:49:41 2025 From: thecybershadow.lists at gmail.com (Vladimir Panteleev) Date: Tue, 23 Dec 2025 12:49:41 +0000 Subject: Cross-compiling a static binary from GitHub Actions In-Reply-To: References: Message-ID: On Saturday, 25 September 2021 at 07:59:08 UTC, Vladimir Panteleev wrote: > The problem: I made a tool written in D, but some people are > having trouble building/running it on non-x86_64 architectures > across various distributions. (I managed to build a static > binary for x86_64.) > > My goal: build a static binary of a D program for Linux-AArch64 > from GitHub Actions (as an artifact). I recently found a nice solution: Nix has excellent support for building and cross-compiling static binaries (which don't depend on any Nix stuff). As a bonus, because Nix builds are deterministic, the binaries are fully bit-wise reproducible. It was very easy to even go a step further and rebuild some dependencies (ncurses, zlib) with LTO, something which would have been quite cumbersome on e.g. Debian. https://github.com/CyberShadow/btdu/blob/master/flake.nix