Ask HN: What's stopping Guix from building static binaries for various targets?

1 day ago

Guix can build for various different targets using `guix build --target <arch>`, and it can build entire linked libraries that can be deployed as a tarball to a target machine via `guix pack --target <arch>`...

But it can't do the one thing that Nix can do reliably and that is produce a single static binary.

What is stopping it?

Many packages are written using the `(build-system gnu-build-system)` macro.

How hard is it to add a `(build-system gnu-build-system 'static)` parameter, that changes the configure step to use the `-static` flag?

In Guix, packages are typically dynamically linked against libraries in the store. Static linking changes not just the configure flags, but also how dependencies are pulled in - you'd have to make sure every dependency is available as a static .a library for the target platform and many Guix packages aren't built with static artifacts at all.

  • So I can understand needing to modify the build flags for all dependencies to generate static artefacts for the final binary, and regenerating these from scratch... but still, isn't that just a single extra parameter in their compile args?