# Linux: version `GLIBCXX_3.4.30' not found (required by ./app) — libstdc++.so.6

**Code:** `GLIBCXX not found` · **Category:** C/C++ · **Seen on:** C/C++, Linux, GCC

The program was built with a newer GCC than the libstdc++ installed on the machine where it runs.

## Meaning

Binaries link dynamically against libstdc++ and glibc. If you build on a recent distribution and copy the binary to an older one, the older library lacks the newer symbol versions. Build on the oldest target system, link statically, or ship the matching runtime.

## Common causes

- Binary built with a newer GCC than the target machine has
- Conda or a bundled libstdc++ shadowing the system one (`LD_LIBRARY_PATH`)
- Copying a binary from Ubuntu 24.04 to 20.04 or to an old container
- Missing newer `libstdc++6` package on the target

## Quick fix

1. Build on (or in a container of) the oldest OS you support
2. Link the C++ runtime statically: `-static-libstdc++ -static-libgcc`
3. Update `libstdc++6` on the target if possible

## Detailed fix by platform

### Linux

1. Check what is there: `strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX | tail`
2. Run `ldd ./app` to see which library is picked up and check `echo $LD_LIBRARY_PATH`

### GCC / Clang

1. `g++ main.cpp -o app -static-libstdc++ -static-libgcc`
2. For glibc errors build inside an older distro image (for example `ubuntu:20.04`)

## Code examples

### See which versions are available

```bash
strings $(g++ -print-file-name=libstdc++.so.6) | grep GLIBCXX_3.4 | sort -V | tail -3
ldd ./app | grep -i stdc
# fix on the build side:
g++ -O2 main.cpp -o app -static-libstdc++ -static-libgcc
```

## How to diagnose

1. **Versions** — Highest GLIBCXX on the target?
2. **Library path** — Which libstdc++ does ldd show?
3. **Build** — Which GCC built the binary?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/cpp/glibcxx-version-not-found)
