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

自作多情 提交于 2021-02-05 05:07:47

问题


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.


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/56781513/understanding-the-gcc-version-and-the-glibc-glibcxx-versions-in-more-detail

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!