Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That's kind of the state of Linux in general. Binaries need to be build against the correct distribution and version. Even static binaries are a gamble.


Steam takes care of the distribution and version mumbo jumbo for you with their runtime

https://github.com/ValveSoftware/steam-runtime

https://gitlab.steamos.cloud/steamrt/steam-runtime-tools/-/b...


Thanks, this is very interesting. So the old native runtime was basically a messy hacky using LD_LIBRARY_PATH and Ubuntu 12.04 libraries, and now they're using containers based on Debian 10 (Steam Runtime 2 'soldier') or Debian 11 (Steam Runtime 3 'sniper').

Edit: Valve actually have some very interesting documents about their compatibility environments:

- https://github.com/ValveSoftware/steam-runtime/blob/master/d...

- https://gitlab.steamos.cloud/steamrt/steamrt/-/blob/steamrt/...

- https://gitlab.steamos.cloud/steamrt/steamrt/-/blob/steamrt/...

- https://gitlab.steamos.cloud/steamrt/steamrt/-/blob/steamrt/...


Not entirely, but it's a lot better than 1.0/Legacy.

https://gitlab.steamos.cloud/steamrt/steam-runtime-tools/-/b...

I hope they'll drop 32-bit support in the runtime with the next major version. More and more distributions are dropping it or are thinking about it. Any new game should really use 64.


I'm not sure this is true tho.

The games by Loki Software are still running great for me. It's a matter of skill and discipline. SDL, OpenGL and alike are very stable.

The problems start when developers start to use lots of small third-party libraries and depend on particular versions of them, but IIRC on Windows it's also solved by simply shipping all the libs with the game.


Discipline? In gamedev? The industry which famously modeled trains as hats and was proud of it?


And why is that a problem if it works? What if I told you that games also don't simulate each atom individually?


Absolutely not a problem, in fact, I enjoy this. But asking game developers for "discipline" is akin to asking frontend developers for forward compatibility - simply not in their culture.


Meanwhile I love the "trains as hats" hack.


I love it too, but what game developers never have, never will and probably even never should — is discipline


Actual static binaries (so including libc) should run just fine anywhere, right? The Linux kernel has always had a very stable ABI.


Yes but that limits you to command line applications. GL and X11 (and I assume Wayland) are always linked dynamically. Granted, those don't suffer from glibc's "DLL version hell", but not sure what happens when you link the main executable statically against musl and then load DLLs which dynamically link glibc.

Another option is to dynamically link against an old glibc version, the Zig toolchain makes that easy also for C/C++ projects.


glibc doesn't suffer from DLL version hell as long as you are not doing anything stupid (like using private symbols). If you commit to using just the "C library" bits you can compile a binary linked against glibc on a distro from 1998 and it will work on modern distros just fine.

There are many issues with libraries breaking backwards compatibility on Linux (like pretty much all GUI ones) but glibc, X11, OpenGL (and to some extent SDL - it used to not be like that, but in recent years they made "SDL1->SDL2" wrappers and there is or will be a "SDL2->SDL3" wrapper too) are fine. I'm not sure about Vulkan but i'd guess that is fine too.


Last I tried the problem was linking against glibc on a new Linux distro and then attempting to run that executable on an old Linux distro which doesn't have a recent-enough glibc installed (usually Debian with their software stack from the last century).

There's probably an obscure linker trick to force an older glibc version number, but if that's the case it really should be the default since the C stdlib is supposed to be ABI backward compatible anyway.


This isn't just a glibc thing but something you can find with any shared library on Linux. For example if you are using a rolling distro and make a build that links against Qt6, the produced binary may not work in another distro that has a slightly older Qt6.

As palata mentioned the "trick" is to build using the oldest version you plan to target. You can use a Docker image with, say, Debian (which has official docker images going back to Squeeze released in 2011) to build the binary and release that.

AFAIK there are some tools that allow you to fudge symbols, etc to allow you to use whatever you have on your system but these feel like brittle solutions and the easiest one is to just build on an older/stable release. It isn't like it takes more than a second to make a VM or docker image anyway :-P.


Well the "trick" is to build with the oldest glibc version you want to support. Nothing more.


It can't be the default, otherwise using any new feature would fail.


When did glibc last introduce a new ABI-breaking feature that's commonly used by applications though?


The recent-ish change to 64 bit time_t was a fairly big one. It shouldn't affect 64 bit targets though.


glibc very much suffers from version hell, because:

a) glibc will drop older versioned symbols over time making your binary not work at all

b) glibc owns ld.so and is not afraid to make incompatible changes, which is why running Sid Meyer's Alpha Centauri linux port requires that you dig out not just libc, but the entire dynamic linking stack and know how to bypass default executable interpreter in ELF files.


...aaaaand stuff like this is exactly why NixOS is the only sensible Linux distro


NixOS removes outdated packages from its repo pretty rapidly... :-/


If you statically link musl, dlopen doesn't work at all. You can't load any shared library.


Not true even for all apps having just libc.

I wanted to port my semi-minimal 3D ECS game engine ~(10k lines) to a minimal distro, so I decided on Alpine after figuring Arch is actually very bloated on comparison.

I had to recompile even the single-executable command line prebuild system (premake5) for musl. Musl is a more minimal version of libc.

Got it to work fine after that, building a few components from source and getting a few like sdl from the distribution's repos. (also had to of course install relevant driver bits to get opengl working as the distro is truly minimal)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: