News for hackers. Stuff that matters.
Re:Single binary executable packages by kristov on Wednesday March 02, 2022 @12:39PM (#30530115)
Or just dynamic link to libc and static link the rest as much as you can. If a binary dynamically links to libc, but is otherwise statically linked, all good no?
Re:Single binary executable packages by BeeOnRope on Wednesday March 02, 2022 @04:20PM (#30533339)
Yes, that was option [3]. The problem is that glibc symbols are versioned and update fairly regularly, so your binary likely won't run on anything with a much older glibc, and glibc versions vary a lot across distros (e.g., some are much slower moving so use very old glibc).

To work around this you need to try to build on an old of a distro as possible, so you use only old symbols... but you don't want to build on an ancient compiler since it might not support the language version or compiler flags you need, so you first build a new old toolchain on the old distro against the old libc, or find a docker container from someone who has already gone though this pain.

Of course, this also means you can't use new libc features: libc is more than just the C runtime, it's also the shim layer between userspace and the kernel, so you might miss out on newer system calls (or have to write the wrappers manually, etc).

It gets even worse for C++.

Re:Single binary executable packages by admax88qqq on Wednesday March 02, 2022 @01:46PM (#30531108)
Pretty good. Glibc does update occasionally. I've hit issues in the past trying to run old proprietary binaries that required libc.so.5

But yeah that's pretty rare tbh.

Re:Single binary executable packages by BeeOnRope on Wednesday March 02, 2022 @04:22PM (#30533363)
The major library version number (e.g., 5 vs 6) isn't enough: the symbols even within lib.so.6 are versions and some may update every glibc version, so in general you may have problems building against a new libc 6 then running on a system with an old libc 6 (you'll get a runtime error from the dynamic loader complaining a missing versioned symbol).
Re:Single binary executable packages by admax88qqq on Thursday March 03, 2022 @01:48PM (#30545003)
Yay for "semantic versioning" lol.