Comment

Comment by BeeOnRope

Creating a portable single-executable in C/C++ on Linux is not particularly easy.

The dominant libc for Linux, glibc, says "static linking is highly discouraged", see [1] among many other sources for the subtle problems it causes.

There are solutions like [2], [3], and [4] but they all have downsides and don't compare at all to e.g., the go (or even rust) single-executable story.

---

[1] https://stackoverflow.com/questions/57476533/why-is-statical...

[2] Link glibc anyway and try to avoid the pitfalls.

[3] Link glibc dynamically but everything else static, and build your exe using an ancient toolchain (or better, a new toolchain built for an ancient libc) so that it works on most distros.

[4] Give up on glibc and statically link an alternative libc like musl.

parent BeeOnRope 4 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton