I want to downgrade my "glibc 2.34" to version 2.27 because when I run ./test_121
on my machine it gave me this error:
/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ./test_121)
My machine is using this version ldd (Ubuntu GLIBC 2.27-3ubuntu1.5) 2.27
.
I installed the glibc 2.27 on my host and extracted it using tar -xf glibc-2.27
, but I don’t know how to execute it. or to do gcc -o test_121
with the 2.27 compiler.
2
Answers
GLIBC-2.34
in the first place — it hasGLIBC-2.27
, downgrading from 2.27 to 2.27 makes no sense.Your problem is that this binary:
./test_121
was built againstGLIBC-2.34
(or later) and requires that version (or newer) to run.Your only choices are to run that binary on a newer system (or in a docker container with
GLIBC-2.34
or newer), or to get a different binary (one that requiresGLIBC-2.27
or older).A binary requesting
GLIBC-2.34
means the binary was compiled against Glibc 2.34 or newer, and it depends on some ABI not available before that version, otherwise the dependency isn’t created.One option to workaround this is to tune the APIs used until you don’t hit that requirement anymore (but it is problematic/difficult), you can find where the problem is by using
readelf -W -s
on the binary, this will show all the used symbols, those with an@
in the name are versioned symbols.The proper way to avoid this is to setup a "sysroot" tree resembling the intended target and cross-compile your application against it, using the
--sysroot
flag for the compiler (supported by GCC and Clang). The sysroot environment can be created by installing a system on an emulator or another machine then copying that, or using tools likedebootstrap
for Debian-based distros,rinse
orrhbootstrap
for redhat-based ones, etc, or you can create a generic one manually building the base system or using some build system (e.g.buildroot
oropenembedded/poky
). In this way, the result will be guaranteed to work with the version it’s compiled against.