Re:Building Outer Wonders for Linux
by Conan_Kudo on Saturday May 22, 2021 @07:32AM
(#27245515)
glibc has so far managed to guarantee backwards compatibility going back to every version that has offered libc.so.6 (which goes back two decades!). They explicitly guarantee that backward compatibility: https://developers.redhat.com/blog/2019/08/01/how-the-gnu-c-...
[ Parent
| on HN ]
Re:Building Outer Wonders for Linux
by AnIdiotOnTheNet on Saturday May 22, 2021 @07:49AM
(#27245608)
Ok, is there a way to say "please compile my binary such that it will work with the oldest version of glibc"? I mean, other than to locate a copy of a distribution with a glibc that old to build on.
I remember you could decide which glibc version, for some specific symbol, you wanted to use.
For example, if you wanted to make your program use the "realpath" version from glibc 2.0, instead of the current one, you could do something like this:
__asm__(".symver realpath,realpath@GLIBC_2.0");
So, even if the glibc version in the build system is more modern (lets say 2.3), your code will also work with older ones, such as 2.0.
Re:Building Outer Wonders for Linux
by AnIdiotOnTheNet on Sunday May 23, 2021 @09:24AM
(#27254851)
Is there a way to do that for every symbol? I'm asking because from what I've read from developers the only reliable way to do this is to compile on an old distribution with an old libc. So either there are problems with using this method or it is very poorly documented.
I haven't found a way, although I never had the need. I remember you could compile your software targeting a specific LSB release, and there were some tools to do that, but I don't know if it would be the same.
Not using new features will usually do that, but I wonder what's up with the math stuff pulling in symbol versions from 2018. There should be an explanation for that one...
Re:Building Outer Wonders for Linux
by AnIdiotOnTheNet on Saturday May 22, 2021 @08:02AM
(#27245697)
Sure, but is there any convenient mechanism to ensure that you don't use new features? I guess what I'm asking is, why does glibc not make this easier to do?
I think the generally accepted way to do that would be a container image running a relatively old distribution. This is exactly what python packages do when they need to distribute binary packages on linux [0]. You are supposed to compile the package in a container (or VM) that runs CentOS 7 (or older if you want broader support), although now the baseline is moving gradually to Debian 9.
Re:Building Outer Wonders for Linux
by AnIdiotOnTheNet on Saturday May 22, 2021 @08:18AM
(#27245794)
So round about, the answer is a firm "no".
Re:Building Outer Wonders for Linux
by Conan_Kudo on Wednesday May 26, 2021 @08:58PM
(#27298111)
I think you can pass a linker flag to make it use the oldest version of each symbol, but I'm not sure what that flag is.