Comment by account42
3 hours ago
You don't need to go full static linking. Just bundle every library that doesn't have string backwards guarantees or rather bundle everything except base system libraires. The same is also how things work on Windows (and thus Wine really). Wine won't be able to run a binary that links to some random libpng or whatever that the compiler found in your System32. The only difference is that Microsoft makes an SDK that gives your some idea of whats a system library you can rely on as well as the ability to target older versions than the system you are building on. The latter can be done on Linux as well but there is no-pre made SDK so the easiest solution ends up being a VM or chroot with older libraries.
> Just bundle [...] everything except base system libraires
That means everything above libc. There are no "base system libraries" in the Linux world for GUI. Not even libX11, that has been deprecated in favour of libxcb, which has been deprecated in favour of not having X11 and running Wayland. Some days I am amazed that the ELF binary format hasn't been deprecated yet...
LibX11 is still alive and kicking. It is however possible to bundle libX11 and/or libxcb (libX11 today sits on top of libxcb) because the wire protocol between them and the X server is also backwards compatible.
And of course Wayland has XWayland to continue compatibility. This doesn't give you access to new toys but neither does restricting yourself to a 30-year old Win32 API.
And beyond libc/libX11/libxcb, libasound has also provided good backwards compatibility with newer systems implementing shims to make it work. You can also use libpulse directly if you don't care about old/opinionated systems though.