'Avoid linking against std::_v2 symbol
I am using Clang++ 10 under Ubuntu 20.04 to compile a certain shared library that will be loaded within the main program, and after recently integrating it with ghc::filesystem (for a C++11 compatible filesystem implementation), starting the program arises a library load link error: undefined symbol: _ZNSt3_V215system_categoryEv.
I found out the compile time linking process points STD to the newer internal std::_v2 namespace implementation, from system's libstdc++, as I've double checked:
adrian@PC-Adrian:~$ strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep system_category
_ZSt15system_categoryv
_ZNSt3_V215system_categoryEv
The program (a game server) ships an embedded older libstdc++ in its bin directory, with this symbol's search result:
adrian@PC-Adrian:~/steamcmd/server_base/bin$ strings libstdc++.so.6 | grep system_category
_ZSt15system_categoryv
So, the library is looking for the std::_V2::system_category() symbol instead of the supposedly older std::system_category() one.
Given the system's libstdc++ already provides the old STD symbol, could this issue be easily solved with any compiler flag or such? I've tried passing -D_GLIBCXX_USE_CXX11_ABI=0 (as I perceived that could make it) to no avail. Although I could get more missing symbols errors after fixing this one.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
