I have a configuration probe that determines which flags are passed to g ++ based on the platform and version. I usually use a later version of gcc than the native version to install to access the C ++ 14 features. On older platforms, this means I need to add -D_GLIBCXX_USE_CXX11_ABI = 0 to use the older C ++ ABI, or I I can not associate with the versions of the C ++ library hosts. However, some new platforms use the new ABI, in this case -D_GLIBCXX_USE_CXX11_ABI = 1 (or nothing at all) is required.
I can do this based on the version of the target platform (i.e. lsb_release -a output), but I need a more general method.
I think I'm halfway with compiling the C ++ global welcome program with a native compiler (unlike my later one), but I can't figure out how to research the ABI version. For instance.
> strings hello | grep ABI
.note.ABI-tag
> strings hello | grep CXX
GLIBCXX_3.4
or similarly in the version of libstdC ++ used by hello probe.
ldd ./hello | grep stdc ++ | sed -e 's _. * / _ / _' | cut -f 1 -d '' | xargs strings | grep
Does anyone have any better suggestions?
update: Actually, I donβt need to do this at all. My real problem was that I had an older version of libstdc ++. The compilation took one of the versions 6.0.20, and the runtime took the incompatible value 6.0.19 (or, conversely, vice versa). I had an unresolved character that I incorrectly blamed on the ABI version. Contrary to popular belief, minor versions of libstdC ++ are not always binary compatible. My intention is to always use the same version at startup and compile time (if you do not use the main server).
source share