Page 1 of 1

New cross-distro backward compatibile way of shipping binary

Posted: Mon Aug 21, 2017 5:55 pm
by devsh
Hi,

For a number of years we've had a problem with our closed sourced game to run on many linux distributions.

The reason for that was, the GLIBC shared libraries which provides all the C and C++ library standard functions (as well as pthreads, etc.) had different versions across the distributions and although backward compatible (older compiled software could still run on newer releases) it precludes anyone from building a binary with the latest GCC toolchain and being able to run it on an older OS with an OLDER GLIBC.

Turns out you can force the dynamic linker to load older versions of symbols from any library with symbol versioning (most GNU Linux system libraries), but this needs to be done explicitly. Hence we've managed to obtain and modify a script to get every-single-funking-function-and-its-highest-version-below-specified-version-cap and put the explicit linker instructions in a C/C++ header file.

https://github.com/devshgraphicsprogram ... es/tag/1.0

Re: New cross-distro backward compatibile way of shipping bi

Posted: Mon Aug 21, 2017 6:13 pm
by hendu
You went the hard way with that. There is nothing in new GCC that requires new glibc, it's perfectly reasonable to run an older distro and compile the latest gcc on it.

For libstdc++ and libgcc_s, I usually statically link those, since there are no shared c++ libraries in use. The GCC runtime library exception allows this.

Re: New cross-distro backward compatibile way of shipping bi

Posted: Mon Aug 21, 2017 9:11 pm
by devsh
I'm talking about compiling the binary on a new distro, with new GLIBC and GCC and shipping to a distro with old GLIBC and old GCC

Re: New cross-distro backward compatibile way of shipping bi

Posted: Tue Aug 22, 2017 7:20 am
by hendu
Yes, and I'm saying that's harder than what you need to have access to new GCC and compatibility with older base libraries.

Re: New cross-distro backward compatibile way of shipping bi

Posted: Tue Aug 22, 2017 9:42 am
by devsh
So how would you do it?

Re: New cross-distro backward compatibile way of shipping bi

Posted: Tue Aug 22, 2017 5:35 pm
by hendu
hendu wrote:You went the hard way with that. There is nothing in new GCC that requires new glibc, it's perfectly reasonable to run an older distro and compile the latest gcc on it.

For libstdc++ and libgcc_s, I usually statically link those, since there are no shared c++ libraries in use. The GCC runtime library exception allows this.

Re: New cross-distro backward compatibile way of shipping bi

Posted: Tue Aug 22, 2017 6:09 pm
by MartinVee
I myself usually compile the standard libraries statically. The executable grows, but it's a small price to pay for the program to be self contained.