The GNU Standard C++ Library, also known as libstdc++, is an open-source implementation of the C++ standard library. Determining the installed version can be important when building or running applications that depend on specific compiler features or ABI compatibility. This tutorial explains how to check libstdc++ version on Linux.
Start by identifying the path of the installed libstdc++.so file. This can be done using the dynamic linker cache:
ldconfig -p | grep libstdc++
Example output:
libstdc++.so.6 (libc6,x86-64) => /lib/x86_64-linux-gnu/libstdc++.so.6
Once the library path is known, inspect the available symbol versions embedded within the file to determine the highest supported GLIBCXX version:
strings /lib/x86_64-linux-gnu/libstdc++.so.6 | grep -E 'GLIBCXX_[0-9]' | sort -V | tail -1
Example output:
GLIBCXX_3.4.33
The resulting value indicates the highest GLIBCXX symbol version available in the installed libstdc++ library, commonly used to check compatibility with compiled C++ binaries.
Explanation of the command:
strings- extracts readable text from the binary.grep- filters entries related to GLIBCXX symbol versions.sort -V- arranges versions in ascending order.tail -1- returns the highest supported version.
Leave a Comment
Cancel reply