Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding the gcc version and the GLIBC, GLIBCXX versions in more detail

Assume I have the following local gcc, g++ version:

$ gcc -v
$ g++ -v
gcc version 6.3.1

I don't understanding the relation and meaning of the following compared to my compiler version:

What is this referring to?

/usr/lib64/libstdc++.so.6

Trying to run a binary and I get this error, what is GLIBCXX_3.4.20 referring to? why is the number starting with 3?

/lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found

What is all this?

$ strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX
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

How about the ldd version?

ldd --version
ldd (GNU libc) 2.17

I can't link all these version numbers together.

like image 397
josh Avatar asked Jun 26 '19 22:06

josh


People also ask

What is Glibcxx?

glibc is the GNU C library . It's an implementation of the standard C library. Any program written in C will use the standard library for things like accessing files and the network, displaying messages to the user, working with processes and so on. It's a fundamental component of the operating system.


2 Answers

I can't link all these version numbers together.

As already mentioned in the comments, the ABI page tells you the relationship between GLIBCXX_... and g++ versions. GLIBCXX_3.4.20 corresponds to g++-4.9.0.

Since you have g++-6.3.1, you should have a version of libstdc++.so.6 with GLIBCXX_3.4.22 in it, but you clearly don't.

It looks like you have multiple versions of libstdc++.so.6: one in /lib64 and another in /usr/lib64. I am guessing that one of them is old, and shouldn't be on the system at all.

P.S. The version of GLIBC has nothing to with your problem, and is irrelevant.

like image 68
Employed Russian Avatar answered Oct 17 '22 02:10

Employed Russian


GLIBC_ and GLIBCXX_ symbol versions have no intrinsic relationship. GLIBC_ belongs to glibc, and GLIBCXX_ to libstdc++. libstdc++ can be built against many different glibc versions, and this can result in different GLIBC_ version references, but the set of GLIBCXX_ versions is not changed by that.

like image 22
Florian Weimer Avatar answered Oct 17 '22 01:10

Florian Weimer