how do I remove `GLIBC_2.27' requirement at compile time?

前端 未结 3 844
感情败类
感情败类 2021-01-19 07:34

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

相关标签:
3条回答
  • 2021-01-19 08:01

    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.

    0 讨论(0)
  • 2021-01-19 08:13

    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++

    0 讨论(0)
  • 2021-01-19 08:22

    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).

    0 讨论(0)
提交回复
热议问题