New cross-distro backward compatibile way of shipping binary

Discussion about everything. New games, 3d math, development tips...
Post Reply
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

New cross-distro backward compatibile way of shipping binary

Post 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
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

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

Post 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.
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

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

Post 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
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

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

Post 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.
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

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

Post 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.
MartinVee
Posts: 139
Joined: Tue Aug 02, 2016 3:38 pm
Location: Québec, Canada

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

Post 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.
Post Reply