The Zig compiler is, in theory, building fully static executables and handling all the cross-compilation shenanigans, including compiling LMDB and all other C dependencies, as well as linking against libc.
For Linux, it's using a musl target and, in theory, the resulting binary should run on Alpine or even on a distroless container. Though I haven’t tested it myself.
If you want to try it out and let me know how it goes, that would be brilliant. With a bit of flag magic, I can produce ridiculously small binaries - less than 2 MB on macOS and Linux or arm)…
So once the binaries have been integrated into the main repo, I might start using it for my own container builds as well. While glibc is faster than musl libc, and even though the images from my "distroless" build above are already quite small, having a 2 to 5 MB multi-arch (x86_64 / arm64) distroless container image would be fantastic.
Side note: I'm very impressed by Zig. It may be the best tool out there for cross-compiling. The fact that I’m able to use it to cross-compile Go code with CGO enabled is just… mind-blowing!
Showing page 1 of
1 pages