Pick version of GLIBC

Hi Folks,

a while ago I asked how to statically compiles dynamic libraries, which by the way is, in general, a very bad idea and should not be done.

However my issues persist, I need to compile a fairly complex project and make it such that it links against GLIBC 2.14 (or less).

I can’t find any simple way to do it and I am wondering if any of you guys has experience with it.

At the moment, it seems to me, that the only solution is to build another toolchain with the GLIBC version that I need, but this is quite convoluted and I haven’t found any simple way to do it.

Do you guys have simpler solutions?

Are you building on Linux? Consider using flatpak or snapcraft perhaps? That way you can build in all of your dependencies independent of system packages.

The best route I’ve found for this is to build in a Docker image of a sufficiently old distribution. CentOS 6 uses Glibc 2.12 for example. You can use the developer toolset repository to get modern versions of things like gcc: https://www.softwarecollections.org/en/scls/rhscl/devtoolset-7/

1 Like

The suggestion of using docker is a great one, and indeed was a path I tried to follow.

However my build requires bindgen which needs several packages that is necessary to compile by hand on Centos6.

What I did was to compile a new toolchain with the GLIBC version I needed and pass the linker flag to cargo, it worked!