C++: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.32' not found
The binary was built with a newer GCC than the machine it is running on, and it needs a libstdc++ symbol version the system library does not have. Nothing is wrong with the code: it works on the build box because that box has the newer library. It shows up when copying binaries to an older distro, or when a conda or bundled toolchain compiles against its own libstdc++ but the loader picks up the system one.
Quick fix
Read the commands before running them. Anything that restarts a service, deletes data or changes permissions should be tried on a non-production system first.
# Which GLIBCXX versions does the system library provide?
strings /lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX_3.4 | tail -3
# Which ones does the binary need, and which library is it loading?
objdump -T ./app | grep GLIBCXX | sort -u -k5 | tail -3
ldd ./app | grep libstdc
# Fix 1: build on the oldest distro you deploy to (or in its container)
# Fix 2: link libstdc++ statically
g++ -static-libstdc++ -static-libgcc -o app main.cpp
# Fix 3: ship the newer library alongside and point the loader at it
# LD_LIBRARY_PATH=/opt/app/lib ./app
How to diagnose C++ errors
C++ errors fall into two very different worlds. Compile and link errors (undefined reference, multiple definition, template substitution failure) are deterministic and are almost always about declarations, the One Definition Rule, or link order. Runtime memory errors (segfaults, double free, use-after-free) are non-deterministic and should never be debugged by reading code alone; a sanitizer will find in seconds what code review misses for days.
If the quick fix above does not resolve it, work through these steps. They apply to this whole class of error, not just to this one message, which is usually what saves the time.
- Rebuild with sanitizers before anything else:
-fsanitize=address,undefined -fno-omit-frame-pointer -g. AddressSanitizer reports the exact allocation and free sites for use-after-free and double-free. - For undefined-reference errors, check link order, remembering that with GNU ld libraries must come after the objects that use them, and check for a C/C++ linkage mismatch that needs
extern "C". - Use
nm -C libfoo.a | grep symbolto confirm the symbol is actually present and to see the demangled signature. A signature that differs by aconstis a different symbol. - Enable core dumps (
ulimit -c unlimited) and open them in gdb withgdb ./binary core, thenbt full. A stack trace beats speculation. - For template errors, read the message from the bottom up. The final line is usually the real constraint that failed; everything above is instantiation context.
Tools worth reaching for
-fsanitize=address,undefinedvalgrindgdb / lldbnm -Cldd
Authoritative references
Primary documentation for this error, worth reading before applying any fix in production.
Related C++ errors
- C++: error: 'format' is not a member of 'std'std::format is C++20 and lives in , which needs both the C++20 flag and a recent enough…
- C++: error: 'uint8_t' does not name a typeThe file uses fixed-width integer types without including , and only ever compiled because…
- C++: error: invalid use of incomplete type 'class Foo'The compiler has seen a forward declaration of Foo but not its definition, and this line…
- C++: error: use of deleted functionThe code tries to call a function that has been explicitly deleted, and nine times out of ten…
- C++: pure virtual method called, terminate called without an active exceptionA pure virtual function was called through an object whose derived part does not exist at…
- C++: relocation R_X86_64_32S can not be used when making a shared objectA shared library must be loadable at any address, so every object in it needs position…
- C++: runtime error: signed integer overflow (UBSan)Signed integer overflow is undefined behaviour in C and C++. The program may appear to work…
- C++: Segmentation fault (core dumped)Program attempted to access memory it doesn't own (e.g., dereferencing null pointer, buffer…
Browse other categories
- HTTP 494xx client errors, 5xx server errors, redirects, headers and protocol problems.
- JavaScript 42npm resolution, async pitfalls, hydration, memory limits and runtime type…
- Database 41Connections, deadlocks, constraints, replication and memory limits.
- AI 35Rate limits, context windows, GPU memory and model-serving failures.
- Network 35Refused connections, timeouts, resets, MTU problems and port exhaustion.
- Python 35Imports, virtual environments, encoding, concurrency and dependency conflicts.
- Kubernetes 34CrashLoopBackOff, ImagePullBackOff, OOMKilled, RBAC, scheduling and storage.
- Docker 27Daemon connectivity, disk space, image pulls, ports and architecture mismatches.
- System 26Disk space, systemd units, file descriptors, OOM killer and scheduled jobs.
- Cloud 25IAM permissions, quotas, service limits and credential failures.
- Security 25JWT validation, CSRF, OAuth grants, SELinux, SSH host keys and CSP.
- TLS 24Untrusted authorities, expiry, hostname mismatch, chains and cipher negotiation.
Something missing or wrong?
This entry is maintained by hand. If the fix is out of date, incomplete, or you have a better one, email a correction and it will be reviewed.