| ▲ | netbioserror 10 hours ago | |
I've been statically linking Nim binaries with musl. It's fantastic. Relatively easy to set up (just a few compiler flags and the musl toolchain), and I get an optimized binary that is indistinguishable from any other static C Linux binary. It runs on any machine we throw it at. For a newer-generation systems language, that is a massive selling point. | ||
| ▲ | cb321 4 hours ago | parent | next [-] | |
Yeah. I've been doing this for almost 10 years now. It's not APE/cosmopolitan (which also "kinda works" with Nim but has many lowest common denominator platform support issues, e.g. posix_fallocate). However, it does let you have very cross-Linux portable binaries. Maybe beyond Linux. Some might appreciate a concrete instance of this advice inline here. For `foo.nim`, you can just add a `foo.nim.cfg`:
There is also a "NimScript" syntax you could use a `foo.nims`: | ||
| ▲ | zoobab 9 hours ago | parent | prev [-] | |
I have an idea for a static linux distribution based on musl, with either an Alpine rebuild or Gentoo-musl: The documentation to make static binary with GLibc is sparce for a reason, they don't like static binaries. | ||