Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does one find what C++11 features have been implemented given a GLIBCXX version

Given a GLIBCXX version of the stdc++ library (example GLIBCXX_3.4.17) given this version, where would one find documentation which specifies what features have been implemented?

Further is there a way to which given the SO NAME version will provide the this same document.

I am working on an embedded system which has an existing version of libstdc++; unfortunately the supplied cross compiler (g++) is at a greater version than what the stdc++ library on the target supports. Upgrading the stdc++ library on the target is not an option. Before I write a lot of code, to only find that it does not run on the target; I would like to know beforehand what is and is not supported.

I have found the GNU Documentation to be useful; however, I am hoping there is a document in which one can get what has been implemented given the symbol version and/or the SO NAME and I just have somehow missed it.

Thanks for any help in advance

like image 294
P Mackenzie Avatar asked Oct 19 '22 20:10

P Mackenzie


1 Answers

given this version, where would one find documentation which specifies what features have been implemented?

You can map a GLIBCXX_A.B.C symbol version to a GCC release by checking
https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html

N.B. that won't be precise, because e.g. GCC 5.1 and GCC 5.2 both use GLIBCXX_3.4.21 in the shared library. To tell them apart check the __GLIBCXX__ macro defined by the libstdc++ headers, also documented on that page.

The manuals for libstdc++ releases are at gcc.gnu.org/onlinedocs/gcc-[X.Y.Z]/libstdc++/manual/ e.g.
https://gcc.gnu.org/onlinedocs/gcc-5.3.0/libstdc++/manual/

Within that manual is a status table showing the implementation status for each standard, the table for C++11 support in GCC 5.3.0 is at
https://gcc.gnu.org/onlinedocs/gcc-5.3.0/libstdc++/manual/manual/status.html#status.iso.2011

Before I write a lot of code, to only find that it does not run on the target; I would like to know beforehand what is and is not supported.

It's not enough to simply avoid using features that aren't supported by the library on the target system. If you link with the cross-compiler then it will depend on the libstdc++.so from that cross-compiler, and will fail to run on the target system if it only has an older libstdc++.so

Upgrading the stdc++ library on the target is not an option.

Then you either need to link statically (creating large executables) or downgrade your cross-compiler to match the target. Or at least force it to use the headers and dynamic library from the same version as found on the target (by overriding the header and library search paths to point to copies of the older files), although that might not work, as the newer g++ might not be able to compile the older headers if they contain some invalid C++ that the older g++ didn't diagnose.

like image 182
Jonathan Wakely Avatar answered Oct 21 '22 15:10

Jonathan Wakely