GLIBCXX_3.4.29 Error: Causes and Fixes

ملخص

Pixel shares a practical guide to diagnosing the GLIBCXX_3.4.29 error and explains why copying a newer libstdc++.so.6 can fail with a deeper glibc issue. It compares GLIBCXX versions across Ubuntu, Debian, Rocky, Alma, and Amazon Linux, and outlines fixes such as using an older toolchain, static linking, or a compatible image.

DEV Community

GLIBCXX_3.4.29 not found - and why copying libstdc++ does not fix it

Short answer GLIBCXX_3.4.29 is a version tag in libstdc++ (the C++ standard library shipped with GCC), not in glibc. The binary was built with a newer GCC than the target host has, so the target's libstdc++.so.6 does not carry that symbol version. The fix is to build with an older toolchain, link the C++ runtime statically, or run inside an image that matches. Copying libstdc++.so.6 from the newer machine does not work — it fails one layer deeper, with a glibc error. Proof below. First: confirm which version is missing ./your-binary

./app: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found

Then ask the target host what it can offer: grep -aoE 'GLIBCXX_3.4.[0-9]+' /usr/lib/x86_64-linux-gnu/libstdc++.so.6 \
| sort -V | tail -1

GLIBCXX_3.4.30

And ask the binary what it needs: readelf --version-info ./app | grep GLIBCXX | head -20
If the highest required GLIBCXX is newer than the highest provided, this is the problem — and no amount of libc fiddling will help. Which distro provides which GLIBCXX Measured inside the official images on 2026-11-14 (full 27-row matrix on the site): Distribution Release Highest GLIBCXX Ubuntu 18.04 3.4.25 Ubuntu 20.04 3.4.28 Ubuntu 22.04 3.4.30 Ubuntu 24.04 3.4.33 Debian 10 3.4.25 Debian 11 3.4.28 Debian 12 3.4.30 Debian 13 3.4.33 Rocky / Alma 8 3.4.25 Rocky / Alma 9 3.4.29 Amazon Linux 2 3.4.24 Amazon Linux 2023 3.4.33 Two things fall out of this table immediately: Rocky 9 / Alma 9 cap at 3.4.29 — a binary needing 3.4.30 from an Ubuntu 22.04 build will not run there even though both are "modern". Alpine ships no GLIBCXX at all. It has musl and no libstdc++ unless you install it, and even then the versions do not line up with glibc distributions. Why copying libstdc++.so.6 fails (measured) This is the advice that circulates most often, so it is worth testing rather than repeating. Build on Ubuntu 24.04 (GCC 13.3, GLIBCXX 3.4.33): $ g++ -std=c++20 -O2 -o hello-new hello.cpp
$ ./hello-new
built with 13.3.0
Run it on Debian 12 (GLIBCXX 3.4.30): $ ./hello-new
./hello-new: /lib/x86_64-linux-gnu/libstdc++.so.6: version GLIBCXX_3.4.32' not found ./hello-new: /lib/x86_64-linux-gnu/libstdc++.so.6: versionGLIBCXX_3.4.31' not found
Now copy the newer libstdc++ across, keeping the SONAME: $ cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.33 ./lib/libstdc++.so.6
$ LD_LIBRARY_PATH=./lib ./hello-new
./hello-new: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.38' not found
(required by ./lib/libstdc++.so.6)
The loader did pick the bundled copy — ldd confirms it: $ LD_LIBRARY_PATH=./lib ldd ./hello-new | grep stdc++
libstdc++.so.6 => ./lib/libstdc++.so.6 (0x00007...)
And it still failed. Not on GLIBCXX any more, but on glibc: the newer libstdc++ from Ubuntu 24.04 was itself built against glibc 2.38, and Debian 12 has 2.36. This is why the "just copy the .so" advice keeps failing in the field: the C++ runtime and the C runtime are a pair. Bringing one forward drags the other forward with it. What actually works 1. Build on an older image (best general answer). One command, no guessing: docker run --rm -v "$PWD":/src -w /src debian:10 \
g++ -std=c++17 -O2 -o app app.cpp
Debian 10 caps at GLIBCXX 3.4.25 and glibc 2.28, so the result runs anywhere newer. Trade-off: you lose newer C++ standard library features. 2. Link the C++ runtime statically. g++ -O2 -static-libstdc++ -static-libgcc -o app app.cpp
This removes libstdc++ from DT_NEEDED entirely. ldd then shows no libstdc++.so.6, and the GLIBCXX requirement disappears. glibc stays dynamic, so you still need a compatible glibc — but the C++ half of the problem is gone. This is the smallest change that fixes a GLIBCXX error. 3. Build fully static against musl when the binary has to run on any Linux at all: docker run --rm -v "$PWD":/src -w /src alpine:3.20 \
sh -c 'apk add --no-cache g++ && g++ -O2 -static -o app app.cpp'
No glibc, no GLIBCXX, no loader search path. Check for dlopen and glibc-only ...
GLIBCXX_3.4.29 Error: Causes and Fixes
Powered by Readybot.io

الأحدث من Pixel

Incident Response: Look Beyond the Red Alert

Pixel’s DEV Community announcement explores how teams can fixate on one failing service while overlooking the real cause of an outage, such as a full …

Sach: AI Fact-Checks WhatsApp Forwards in India

Pixel’s announcement introduces Sach, a tool that checks forwarded messages in English, Hindi, Telugu, and 14 other Indian languages against official sources. It gives cited …

Java 25 Removes SecurityManager: What to Fix

Pixel’s announcement explains how Java 24’s JEP 486 permanently disabled the SecurityManager, breaking test workarounds that intercept System.exit. It recommends returning exit codes or throwing …

Why a Java HPA Got Stuck at 20 Kubernetes Pods

Pixel shares how a Spring Boot pricing service autoscaled to 20 Kubernetes pods and stayed there because the JVM retained committed heap memory after traffic …