News for hackers. Stuff that matters.
Re:Win32 is the stable Linux ABI by microtonal on Tuesday December 30, 2025 @02:13PM (#46436812)
At least glibc uses versioned symbols. Hundreds of other widely-used open source libraries don't.
Re:Win32 is the stable Linux ABI by afishhh on Tuesday December 30, 2025 @03:55PM (#46437881)
> Hundreds of other widely-used open source libraries don't.

Correct me if I'm wrong but I don't think versioned symbols are a thing on Windows (i.e. they are non-portable). This is not a problem for glibc but it is very much a problem for a lot of open source libraries (which instead tend to just provide a stable C ABI if they care).

Re:Win32 is the stable Linux ABI by Const-me on Tuesday December 30, 2025 @07:04PM (#46439777)
> versioned symbols are a thing on Windows

There’re quite a few mechanics they use for that. The oldest one, call a special API function on startup like InitCommonControlsEx, and another API functions will DLL resolve differently or behave differently. A similar tactic, require an SDK defined magic number as a parameter to some initialization functions, different magic numbers switching symbols from the same library; examples are WSAStartup and MFStartup.

Around Win2k they did side by side assemblies or WinSxS. Include a special XML manifest into embedded resource of your EXE, and you can request specific version of a dependent API DLL. The OS now keeps multiple versions internally.

Then there’re compatibility mechanics, both OS builtin and user controllable (right click on EXE or LNK, compatibility tab). The compatibility mode is yet another way to control versions of DLLs used by the application.

Pretty sure there’s more and I forgot something.

Re:Win32 is the stable Linux ABI by cesarb on Tuesday December 30, 2025 @07:28PM (#46439946)
> There’re quite a few mechanics they use for that. The oldest one, call a special API function on startup [...]

Isn't the oldest one... to have the API/ABI version in the name of your DLL? Unlike on Linux which by default uses a flat namespace, on the Windows land imports are nearly always identified by a pair of the DLL name and the symbol name (or ordinal). You can even have multiple C runtimes (MSVCR71.DLL, MSVCR80.DLL, etc) linked together but working independently in the same executable.

Re:Win32 is the stable Linux ABI by rcxdude on Wednesday December 31, 2025 @09:18AM (#46444244)
Linux can do this as well, the issue is that just duplicates how many versions you need to have installed, and it's not that different in the limit from having a container anyway. The symbol versioning means you can just have the latest version of the library and it remains compatible with software built against old versions. (Especially because when you have multiple versions of a library linked into the same process you can wind up with all kinds of tricky behaviour if they aren't kept strictly separated. There's a lot of footguns in Windows around this, especially with the way DLLs work to allow this kind of seperation in the first place).
Re:Win32 is the stable Linux ABI by Const-me on Wednesday December 31, 2025 @09:47AM (#46444528)
I did forget to mention something important. Since about Vista, Microsoft tends to replace or supplement C WinAPI with IUnknown based object-oriented ones. Note IUnknown doesn’t necessarily imply COM; for example, Direct3D is not COM: no IDispatch, IPC, registration or type libraries.

IUnknown-based ABIs exposing methods of objects without any symbols exported from DLLs. Virtual method tables are internal implementation details, not public symbols. By testing SDK-defined magic numbers like SDKVersion argument of D3D11CreateDevice factory function, the DLL implementing the factory function may create very different objects for programs built against different versions of Windows SDK.

Re:Win32 is the stable Linux ABI by tsujamin on Wednesday December 31, 2025 @12:21PM (#46446126)
There’s also API Sets: where DLLs like api-win-blah-1.dll acts as a proxy for another DLL both literally, with forwarder exports, and figuratively, with a system-wide in-memory hashmap between api set and actual DLL.

Iirc this is both for versioning, but also so some software can target windows and Xbox OS’s whilst “importing” the same api-set DLL? Caused me a lot of grief writing a PE dynamic linker once.

https://bookkity.com/article/api-sets

Re:Win32 is the stable Linux ABI by ok123456 on Tuesday December 30, 2025 @02:28PM (#46436955)
Versioned glibc symbols are part of the reason that binaries aren't portable across Linux distributions and time.
Re:Win32 is the stable Linux ABI by ben-schaaf on Tuesday December 30, 2025 @03:56PM (#46437889)
Only because people aren't putting in the effort to build their binaries properly. You need to link against the oldest glibc version that has all the symbols you need, and then your binary will actually work everywhere(*).

* Except for non-glibc distributions of course.

Re:Win32 is the stable Linux ABI by ok123456 on Tuesday December 30, 2025 @04:14PM (#46438074)
If it requires effort to be correct, that's a bad design.

Why doesn't the glibc use the version tag to do the appropriate mapping?

Re:Win32 is the stable Linux ABI by mikkupikku on Tuesday December 30, 2025 @05:31PM (#46438862)
I think even calling it a "design" is dubious. It's an attribute of these systems that arose out of the circumstance, nobody ever sat down and said it should be this way. Even Torvalds complaining about it doesn't mean it gets fixed, it's not analogous to Steve Jobs complaining about a thing because Torvalds is only in charge of one piece of the puzzle, and the whole image that emerges from all these different groups only loosely collaborating with each other isn't going to be anybody's ideal.

In other words, the Linux desktop as a whole is a Bazaar, not Cathedral.

Re:Win32 is the stable Linux ABI by ok123456 on Thursday January 01, 2026 @11:07PM (#46461295)
> In other words, the Linux desktop as a whole is a Bazaar, not Cathedral.

This was true in the 90s, not the 2020s.

There are enough moneyed interests that control the entirety of Linux now. If someone at Canonical or Red Hat thought a glibc version translation layer (think WINE, but for running software targeted for Linux systems made more than the last breaking glibc version) was a good enough idea, it could get implemented pretty rapidly. Instead of win32+wine being the only stable abi on Linux, Linux could have the most stable abi on Linux.

Re:Win32 is the stable Linux ABI by LegionMammal978 on Tuesday December 30, 2025 @08:45PM (#46440400)
But to link against an old glibc version, you need to compile on an old distro, on a VM. And you'll have a rough time if some part of the build depends on a tool too new for your VM. It would be infinitely simpler if one could simply 'cross-compile' down to older symbol versions, but the tooling does not make this easy at all.
Re:Win32 is the stable Linux ABI by nineteen999 on Wednesday December 31, 2025 @02:53AM (#46442269)
Huh? Bullshit. You could totally compile and link in a container.
Re:Win32 is the stable Linux ABI by LeFantome on Wednesday December 31, 2025 @03:12AM (#46442339)
Ok, so you agree with him except where he says “in a VM” because you say you can also do it “in a container”.

Of course, you both leave out that you could do it “on real hardware”.

But none of this matters. The real point is that you have to compile on an old distro. If he left out “in a VM”, you would have had nothing to correct.

Re:Win32 is the stable Linux ABI by nineteen999 on Wednesday December 31, 2025 @03:20AM (#46442374)
I'm not disagreeing that glibc symbol versioning could be better. I raised it because this is probably one of the few valid use cases for containers where they would have a large advantage over a heavyweight VM.

But it's like complaining that you might need a VM or container to compile your software for Win16 or Win32s. Nobody is using those anymore. Nor really old Linux distributions. And if they do, they're not really going to complain about having to use a VM or container.

As C/C++ programmer, the thing I notice is ... the people who complain about this most loudly are the web dev crowd who don't speak C/C++, when some ancient game doesn't work on their obscure Arch/Gentoo/Ubuntu distribution and they don't know how to fix it. Boo hoo.

But they'll happily take a paycheck for writing a bunch of shit Go/Ruby/PHP code that runs on Linux 24/7 without downtime - not because of the quality of their code, but due to the reliability of the platform at _that_ particular task. Go figure.

Re:Win32 is the stable Linux ABI by Rohansi on Wednesday December 31, 2025 @05:10AM (#46442894)
> But they'll happily take a paycheck for writing a bunch of shit Go/Ruby/PHP code that runs on Linux 24/7 without downtime - not because of the quality of their code, but due to the reliability of the platform at _that_ particular task.

But does the lack of a stable ABI have any (negative) effect on the reliability of the platform?

Re:Win32 is the stable Linux ABI by nineteen999 on Wednesday December 31, 2025 @05:49PM (#46449173)
Only for people who want to use it as a desktop replacement for Windows or MacOS I guess? There are no end of people complaining they can't get their wifi or sound card or trackpad working on (insert-obscure-Linux-distribution-here).

Like many others, I have Linux servers running over 2000-3000 days uptime. So I'm going to say no, it doesn't, not really.

Re:Win32 is the stable Linux ABI by imtringued on Wednesday December 31, 2025 @05:21PM (#46448965)
>As C/C++ programmer, the thing I notice is ... the people who complain about this most loudly are the web dev crowd who don't speak C/C++, when some ancient game doesn't work on their obscure Arch/Gentoo/Ubuntu distribution and they don't know how to fix it. Boo hoo.

You must really be behind the times. Arch and Gentoo users wouldn't complain because an old game doesn't run. In fact the exact opposite would happen. It's not implausible for an Arch or Gentoo user to end up compiling their code on a five hour old release of glibc and thereby maximize glibc incompatibility with every other distribution.

Re:Win32 is the stable Linux ABI by nineteen999 on Wednesday December 31, 2025 @07:43PM (#46449983)
Re:Win32 is the stable Linux ABI by account42 on Monday January 12, 2026 @08:27AM (#46588184)
Glibc strives for backwards (but not forwards) compatibility so barring exceptions (which are extremely rare but nobody is perfect), using a newer glibc than what something was built for does not cause any issues, only using an older glibc would.
Re:Win32 is the stable Linux ABI by jhasse on Wednesday December 31, 2025 @03:52AM (#46442512)
It's actually doable without an old glibc as it was done by the Autopackage project: https://github.com/DeaDBeeF-Player/apbuild

That never took off though, containers are easier. Wirh distrobox and other tools this is quite easy, too.

Re:Win32 is the stable Linux ABI by Denvercoder9 on Wednesday December 31, 2025 @08:30AM (#46443902)
> It would be infinitely simpler if one could simply 'cross-compile' down to older symbol versions, but the tooling does not make this easy at all.

It's definitely not easy, but it's possible: using the `.symver` assembly (pseudo-)directive you can specify the version of the symbol you want to link against.

Re:Win32 is the stable Linux ABI by yx827ha on Wednesday December 31, 2025 @09:32AM (#46444349)
Check out `zig cc`. It let's you target specific glibc versions. It's a pretty amazing C toolchain.

https://andrewkelley.me/post/zig-cc-powerful-drop-in-replace...

Re:Win32 is the stable Linux ABI by account42 on Monday January 12, 2026 @08:23AM (#46588147)
> you need to compile on an old distro

Wrong.

> on a VM.

Wrong.

Cross-compiling is a thing.

Re:Win32 is the stable Linux ABI by forrestthewoods on Tuesday December 30, 2025 @11:45PM (#46441361)
> Only because people aren't putting in the effort to build their binaries properly.

Because Linux userland is an unmitigated clusterfuck of bad design that makes this really really really hard.

GCC/Clang and Glibc make it effectively impossible almost impossible to do this on their own. The only way you can actually do this is:

1. create a userland container from the past 2. use Zig which moved oceans and mountains to make it somewhat tractable

It's awful.

Re:Win32 is the stable Linux ABI by microtonal on Thursday January 01, 2026 @12:57PM (#46456259)
We are using Nix to do this. It’s only a few lines of code. We build a gcc 14 stdenv that uses an old glibc.

But I agree that this should just be a simple target SDK flag.

I think the issue is that the Linux community is generally hostile towards proprietary software and it’s less of an issue for FLOSS because they can always be compiled against the latest.

Re:Win32 is the stable Linux ABI by account42 on Monday January 12, 2026 @08:22AM (#46588128)
This is not a problem with the userland, but with the SDK - or rather a lack of one.
Re:Win32 is the stable Linux ABI by TUSF on Wednesday December 31, 2025 @05:11AM (#46442898)
> You need to link against the oldest glibc version that has all the symbols you need

Or at least the oldest one made before glibc's latest backwards incompatible ABI break.

Re:Win32 is the stable Linux ABI by chrismorgan on Wednesday December 31, 2025 @05:35AM (#46443020)
I don’t understand why this is the case, and would like to understand. If I want only functions f1 and f2 which were introduced in glibc versions v1 and v2, why do I have to build with v2 rather than v3? Shouldn’t the symbols be named something like glibc_v1_f1 and glibc_v2_f2 regardless of whether you’re compiling against glibc v2 or glibc v3? If it is instead something like “compiling against vN uses symbols glibc_vN_f1 and glibc_vN_f2” combined with glibc v3 providing glibc_v1_f1, glibc_v2_f1, glibc_v3_f1, glibc_v2_f2 and glbc_v3_f2… why would it be that way?
Re:Win32 is the stable Linux ABI by Denvercoder9 on Wednesday December 31, 2025 @08:26AM (#46443885)
> why would it be that way?

It allows (among other things) the glibc developers to change struct layouts while remaining backwards compatible. E.g. if function f1 takes a struct as argument, and its layout changes between v2 and v3, then glibc_v2_f1 and glibc_v3_f1 have different ABIs.

Re:Win32 is the stable Linux ABI by rcxdude on Wednesday December 31, 2025 @09:12AM (#46444194)
Individual functions may have a lot of different versions. They do only update them if there is an ABI change (so you may have e.g. f1_v1, f1_v2, f2_v2, f2_v3 as synbols in v3 of glibc) but there's no easy way to say 'give me v2 of every function'. If you compile against v3 you'll get f2_v3 and f1_v2 and so it won't work on v2.
Re:Win32 is the stable Linux ABI by chrismorgan on Wednesday December 31, 2025 @10:12AM (#46444799)
Why are they changing? And I presume there must be disadvantages to staying on the old symbols, or else they wouldn’t be changing them—so what are those disadvantages?
Re:Win32 is the stable Linux ABI by account42 on Monday January 12, 2026 @08:35AM (#46588271)
Depends on the functions. One example is memcpy - the API specifies that the source and destination must not overlap but the original implementation in glibc didn't care. When they wanted to optimize the implementation they decided to introduce a new version of memcpy rather than breaking older binaries that inadvertently relied on on the existing behavior even if that was never guaranteed by the API. Old binaries keep getting the older but slower memcpy, new binaries get the optimized memcpy.

Other examples are keeping bug compatibility, when standards are revised to require incompatible behavior, or to introduce additional safety features that require additional (hidden) arguments automatically passed to functions which changes their ABI.

Re:Win32 is the stable Linux ABI by account42 on Monday January 12, 2026 @08:21AM (#46588115)
No, versioned symbols are required for ABI compatibility.

The only thing that is lacking is an SDK to easily target older glibc versions compared to the one you are using on your build server - but that's something that you can build yourself with some effort.

Re:Win32 is the stable Linux ABI by grishka on Tuesday December 30, 2025 @07:05PM (#46439787)
Yeah and nothing ever lets you pick which versions to link to. You're going to get the latest ones and you better enjoy that. I found it out the hard way recently when I just wanted to do a perfectly normal thing of distributing precompiled binaries for my project. Ended up using whatever "Amazon Linux" is because it uses an old enough glibc but has a new enough gcc.
Re:Win32 is the stable Linux ABI by jhasse on Wednesday December 31, 2025 @03:49AM (#46442498)
You can choose the version. There was apgcc from the (now dead) Autopackage project which did just that: https://github.com/DeaDBeeF-Player/apbuild
Re:Win32 is the stable Linux ABI by rcxdude on Wednesday December 31, 2025 @09:14AM (#46444201)
It's not at all straightforward, it should be the kind of thing that's just a compiler flag, as opposed to needing to restructure your build process to support it.
Re:Win32 is the stable Linux ABI by grishka on Wednesday December 31, 2025 @11:32AM (#46445615)
Yeah that's what I meant. I also came across some script with redefinitions of C standard library functions that supposedly also allows you to link against older glibc symbols. I couldn't make it work.

Any half-decent SDK should allow you to trivially target an older platform version, but apparently doing trivial-seeming things without suffering is not The Linux Way™.

Re:Win32 is the stable Linux ABI by account42 on Monday January 12, 2026 @08:39AM (#46588323)
The reason that there is no SDK is because containers (and before that sysroots) are good enough that no one bothers to maintain the 100% usability solution.
Re:Win32 is the stable Linux ABI by account42 on Monday January 12, 2026 @08:37AM (#46588292)
It's not straightforward and yes it should be easier, but it's also not rocket science. Containers have made it approachable for the average developer.