Skip to content
Advertisement

appname: /lib/libc.so.6: version `GLIBC_2.8′ not found (required by appname)

ldd -v appname

linux-gate.so.1 =>  (0x00949000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00cea000)
libm.so.6 => /lib/libm.so.6 (0x00a83000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00ba1000)
libc.so.6 => /lib/libc.so.6 (0x0015c000)
/lib/ld-linux.so.2 (0x0012f000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00b93000)

Version information:
appname:
    libm.so.6 (GLIBC_2.0) => /lib/libm.so.6
    libc.so.6 (GLIBC_2.8) => not found
    libc.so.6 (GLIBC_2.2) => /lib/libc.so.6
    libc.so.6 (GLIBC_2.3.2) => /lib/libc.so.6
    libc.so.6 (GLIBC_2.7) => not found
    libc.so.6 (GLIBC_2.4) => /lib/libc.so.6
    libc.so.6 (GLIBC_PRIVATE) => /lib/libc.so.6
    libc.so.6 (GLIBC_2.1) => /lib/libc.so.6
    libc.so.6 (GLIBC_2.1.3) => /lib/libc.so.6
    libc.so.6 (GLIBC_2.2.4) => /lib/libc.so.6
    libc.so.6 (GLIBC_2.3) => /lib/libc.so.6
    libc.so.6 (GLIBC_2.0) => /lib/libc.so.6
    libstdc++.so.6 (CXXABI_1.3) => /usr/lib/libstdc++.so.6
    libstdc++.so.6 (GLIBCXX_3.4.5) => /usr/lib/libstdc++.so.6
    libstdc++.so.6 (GLIBCXX_3.4) => /usr/lib/libstdc++.so.6
    libpthread.so.0 (GLIBC_2.2) => /lib/libpthread.so.0
    libpthread.so.0 (GLIBC_2.1) => /lib/libpthread.so.0
    libpthread.so.0 (GLIBC_2.0) => /lib/libpthread.so.0
    libpthread.so.0 (GLIBC_2.3.2) => /lib/libpthread.so.0
/lib/libpthread.so.0:
    ld-linux.so.2 (GLIBC_2.3) => /lib/ld-linux.so.2
    ld-linux.so.2 (GLIBC_2.1) => /lib/ld-linux.so.2
    ld-linux.so.2 (GLIBC_PRIVATE) => /lib/ld-linux.so.2
    libc.so.6 (GLIBC_2.1.3) => /lib/libc.so.6
    libc.so.6 (GLIBC_2.1) => /lib/libc.so.6
    libc.so.6 (GLIBC_2.3.2) => /lib/libc.so.6
    libc.so.6 (GLIBC_2.2) => /lib/libc.so.6
    libc.so.6 (GLIBC_PRIVATE) => /lib/libc.so.6
    libc.so.6 (GLIBC_2.0) => /lib/libc.so.6
/lib/libm.so.6:
    ld-linux.so.2 (GLIBC_PRIVATE) => /lib/ld-linux.so.2
    libc.so.6 (GLIBC_2.1.3) => /lib/libc.so.6
    libc.so.6 (GLIBC_2.0) => /lib/libc.so.6
/usr/lib/libstdc++.so.6:
    ld-linux.so.2 (GLIBC_2.3) => /lib/ld-linux.so.2
    libgcc_s.so.1 (GCC_4.2.0) => /lib/libgcc_s.so.1
    libgcc_s.so.1 (GLIBC_2.0) => /lib/libgcc_s.so.1
    libgcc_s.so.1 (GCC_3.3) => /lib/libgcc_s.so.1
    libgcc_s.so.1 (GCC_3.0) => /lib/libgcc_s.so.1
    libc.so.6 (GLIBC_2.3.2) => /lib/libc.so.6
    libc.so.6 (GLIBC_2.4) => /lib/libc.so.6
    libc.so.6 (GLIBC_2.1) => /lib/libc.so.6
    libc.so.6 (GLIBC_2.3) => /lib/libc.so.6
    libc.so.6 (GLIBC_2.1.3) => /lib/libc.so.6
    libc.so.6 (GLIBC_2.0) => /lib/libc.so.6
    libc.so.6 (GLIBC_2.2) => /lib/libc.so.6
/lib/libc.so.6:
    ld-linux.so.2 (GLIBC_PRIVATE) => /lib/ld-linux.so.2
    ld-linux.so.2 (GLIBC_2.3) => /lib/ld-linux.so.2
    ld-linux.so.2 (GLIBC_2.1) => /lib/ld-linux.so.2
/lib/libgcc_s.so.1:
    libc.so.6 (GLIBC_2.1.3) => /lib/libc.so.6
    libc.so.6 (GLIBC_2.2.4) => /lib/libc.so.6
    libc.so.6 (GLIBC_2.4) => /lib/libc.so.6
    libc.so.6 (GLIBC_2.0) => /lib/libc.so.6

appname is compiled on Ubuntu 9.10, trying to run compiled product on Centos 5.

My guess is that Centos5’s /lib/libc.so.5 provides up to version GLIBC_2.4, but appname calls for GLIBC_2.8.

But here’s the funny thing. This problem didn’t happen until I started linking to boost’s system library. Before it was just boost’s thread library, but now I need both thread and system. I did compile boost on that Ubuntu system. I’m now going to try to compile boost on CentOs, and bring over the generated .a files. I’m linking to the boost .a files btw.

Question, how do I reduce these types of headaches with versioning? Does any use any tricks like setting up a chroot environment with lower library versions, in which you’d compile a product? Clearly, compiling on a newer linux distro quickly makes your product incompatible with even the slightest older version of linux. How do people ship binaries with some decent compatibility? Yes, I can do static linking, but libc can not be statically linked correct?

Advertisement

Answer

Using a chroot environment is one way of doing it, but you don’t need all that work. You can set up an older, reference version of your SDK (including libc and others) somewhere, and then force gcc to link against that rather than the libraries and headers in the standard system directories. The GCC options to do so are: -isystem, -isysroot and --sysroot.

As an example, Apple’s gcc does that very often, linking to various SDK versions depending which OS version you’re targeting.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement