Closed balsoft closed 2 years ago
@balsoft Thanks! I did not think about it... Will fix! One question: why do you suggest to use musl for static linking? Is it because it's more minimal and the executable will result in smaller size or because libc is not as portable?
Statically linking to glibc is discouraged and not supported by upstream: https://stackoverflow.com/questions/57476533/why-is-statically-linking-glibc-discouraged
Just uploaded the statically linked binary to v0.2.2 release. I didn't use Nix, though, simply used musl wrapper for gcc:
make CC=musl-gcc LDFLAGS=-static
I assume this method works too because both ldd
and file
indicate that the resulting binary is statically linked.
Thanks!
Typically, when people distribute standalone binaries for Linux, they are expected to be statically linked and have no external library dependencies. However, it is not the case for the binary distributed with the release now:
This may cause issues when running on musl systems, or on systems without
/lib/ld-linux-x86-64.so.2
since then the hardcoded interpreter doesn't exist. One way to avoid such dependencies is to produce a statically linked executable linked to musl. E.g. with Nix:The resulting executable will be a bit larger (since it carries the relevant parts of libc with it) but it should work on a much wider set of systems, and do so more reproducibly and consistently.