I\'ve been using a docker image for c++ compilation. It\'s based on Ubuntu 18.04. When I attempt to run on some Ubuntu 16 systems, I get this message:
/lib/x86_64-li
I faced the same problem.
/lib/i386-linux-gnu/libm.so.6: version `GLIBC_2.27' not found (required by your_lib.so)
After searching over the internet, I found some links that could be useful.
Static link: Link with -static. See How can I link to a specific glibc version?
Using docker: See Can docker solve a problem of mismatched C shared libraries?
Proprietary solution: See https://github.com/wheybags/glibc_version_header
I have decided to follow the first one. So I created a static library for your_lib.so and linked it statically with my binary.
Try symbol versioning, e.g.:
__asm__(".symver old_foo,foo@VERS_1.1");
Related question: Fedora 28 / GLIBC 2.27 libm.so.6 logf() and powf() c++
You need to build against an older glibc version. Very few distributions, if any, support that out of the box. The only practical way at the moment is to build on an older distribution.
Some distributions with long support cycles offer newer GCC versions that do not require newer system compilers (such as Developer Toolset, which is available for CentOS and Red Hat Enterprise Linux).