distroproof

How to fix "version GLIBC_x.xx not found"

Your binary runs on your machine but fails on an older server. It was built against a newer glibc than the target system has.

./mytool: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ./mytool)

Why it happens

glibc is backward compatible but not forward compatible. A binary built on an old system generally runs on newer ones, but a binary built on a new system can require symbols that older systems do not have.

Check what you have and what you need

The glibc version on the target system:

ldd --version | head -1

The newest glibc symbol version your binary requires:

objdump -T ./mytool | grep -o 'GLIBC_[0-9.]*' | sort -V | tail -1

How to fix it

  1. Build on the oldest system you support. Compile in a container of that release, for example an older Debian or AlmaLinux image. This is the most common fix.
  2. Target an older glibc with Zig. zig cc -target x86_64-linux-gnu.2.28 links against that glibc version without an old build machine.
  3. Link statically against musl. The binary then does not depend on the system C library at all. See the Alpine guide for the build targets.
  4. For Python wheels, use manylinux. cibuildwheel builds in manylinux images, which exist for this exact problem.

What not to do

Do not replace or upgrade glibc by hand on a running system. Almost every program depends on it, and a mismatch can leave the machine unable to run basic commands. Upgrade through the distribution's own release process, or fix the build.