GLIBCXX_3.4.32 not found - Debian 12

Hello! I have installed Debian 12. GCC(c++/g++) upgraded to 13.3.0 from source.
But I still having error when I try to run my old programs(were compiled by g++-13 on Debian Testing).

The error:

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


Recompilation gives one more error:

/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.32' not found
/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.31' not found


ldd output:

linux-vdso.so.1 (0x00007ffda7384000)
	libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f19efc00000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f19efe71000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f19efa1f000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f19ef940000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f19efee0000)



/usr/lib/x86_64-linux-gnu/

lrwxrwxrwx  1 root root        19 Jan  8  2023 libstdc++.so.6 -> libstdc++.so.6.0.30
-rw-r--r--  1 root root   2190440 Jan  8  2023 libstdc++.so.6.0.30


strings...

GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_3.4.20
GLIBCXX_3.4.21
GLIBCXX_3.4.22
GLIBCXX_3.4.23
GLIBCXX_3.4.24
GLIBCXX_3.4.25
GLIBCXX_3.4.26
GLIBCXX_3.4.27
GLIBCXX_3.4.28
GLIBCXX_3.4.29
GLIBCXX_3.4.30
GLIBCXX_DEBUG_MESSAGE_LENGTH


I tried to install libstdc++6-13-dbg_13.3.0-6_amd64 from http://ftp.de.debian.org/debian/pool/main/g/gcc-13/ but there are dependency errors. It needs higher versions of the related libraries.

How to upgrade libstdc++.so.6 to GLIBCXX_3.4.32? Any suggestions please?
Last edited on
I should add - I have the latest version of the libstdc++6 for Debian 12


libstdc++6 is already the newest version (12.2.0-14)
Last edited on
So, you are running on Debian 12, but you are using a "custom" version of GCC (g++) that you have compiled from the sources?

It looks like the binary (or one if it dependencies) was compiled with a newer version of libstdc++6 than the version of libstdc++6 that is available in Debian 12. Which is not much surprising, considering that you are using a custom (newer) GCC version for building.

Why not use the GCC (g++) version that comes with Debian 12?

Otherwise, I think that your only option probably is to build the matching version of libstdc++6 yourself too (if you haven't already, as part of your custom GCC), and then make your binary use that version at runtime ... possibly by setting the LD_LIBRARY_PATH accordingly.

BTW: If you really need a newer GCC than what comes with Debian 12, it's probably easier to just upgrade to Debian "Testing" (Trixie).
Last edited on
Debian 12 comes with GCC 11.
Reason of using non-standard version of GCC is libraries. I need full support of std::chrono, std::format. Custom libraries for development have dependencies as well.


Otherwise, I think that your only option probably is to build the matching version of libstdc++6 yourself too (if you haven't already, as part of your custom GCC)


It is not part of g++ (GCC) 13.3.0 as we can see. The problem is to find out the correct libraries.
I'm trying to find something from there: http://ftp.de.debian.org/debian/pool/main/g/gcc-13/ , but still with no luck. So, maybe this is a wrong way?
kigar64551
BTW: If you really need a newer GCC than what comes with Debian 12, it's probably easier to just upgrade to Debian "Testing" (Trixie).


The upgrade cannot be rolled back. It affects the entire system. I don't want this again.
btw, it worked fine on Debian Testing Bookworm. Now I got stable Bookworm, but it doesn't work((
Last edited on
libstdc++ is closely bound to GCC/g++. So, if you use a newer GCC/g++, it likely comes with (and uses) a newer version of libstdc++, e.g. to enable new C++ features. But this means that the resulting binary will need the newer libstdc++ at runtime too.

Problem is that your Debian 12 base system provides the older version of libstdc++, which matches its "default" GCC/g++ version and which is what all programs that ship with Debian 12 expect. So, as pointed out before, you would probably have to build the newer version of libstdc++ (if it hasn't already been built as part of the newer GCC/g++ version) and make your program use that newer libstdc++ version at runtime. Note that you can use LD_LIBRARY_PATH to make your program load shared libraries from a non-standard directory.

Anyway, if you have Docker installed, then you can start a Debian "Testing" (aka "Trixie") or "Unstable" (aka "Sid") from your current Debian 12 (aka "Bookworm") with a single command without making any changes to your "host" operating system. For example:
docker run -it debian:testing

This way you get a consistent and fully self-contained build and execution environment inside of the container:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
$ docker run -it debian:sid
Unable to find image 'debian:sid' locally
sid: Pulling from library/debian
b801efa715ff: Pull complete 
Digest: sha256:08cc1a90963e48072614d24e816bb659e62ca9db485151785e12331998766627
Status: Downloaded newer image for debian:sid

root@7b5404b2bef9:/# apt-get update && apt-get install -y g++
Hit:1 http://deb.debian.org/debian sid InRelease
[...]
Processing triggers for libc-bin (2.40-2) ...

root@7b5404b2bef9:/# g++ -v
gcc version 14.2.0 (Debian 14.2.0-5) 

And, if you don't like it anymore, you can throw the container away in one second 😏
Last edited on
Thank you kigar64551 for the detailed answer.

I found the solution. :)

1. find / -name "libstdc++.so*"
2. sudo cp /usr/local/lib64/libstdc++.so.6.0.32 /usr/lib/x86_64-linux-gnu/
3. sudo ln -sf libstdc++.so.6.0.32 libstdc++.so.6
For comparison:
RHEL 9 / AlmaLinux 9 does default to GCC 11, just like Debian 12.
Not only that, but the included library is 'libstdc++.so.6.0.29' -- one step "behind" Debian.

There are, however, "gcc-toolset-13*" packages for RHEL 9 that provide GCC 13.
These have "libstdc++.so", but that is no ordinary so. It is text:
# cat /opt/rh/gcc-toolset-13/root/usr/lib/gcc/x86_64-redhat-linux/13/libstdc++.so
/* GNU ld script
   Use the shared library, but some functions are only in
   the static library, so try that secondarily.  */
OUTPUT_FORMAT(elf64-x86-64)
INPUT ( /usr/lib64/libstdc++.so.6 -lstdc++_nonshared )

The 'libstdc++_nonshared.a' is from the toolset.
(The content of Toolset 13 is not in "default locations"; environment has to be set to explicitly use it. This prevents GCC 13 from automatically showing up. Executables built with GCC 13 do, however, run in "normal" environment.)
Registered users can post here. Sign in or register to post.