https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67903
--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Yucheng Low from comment #5) > - We compile as a shared library to be imported into Python as part of a > python > module. > - We want to use C++11 features yet we want to be able to run on > relatively old Linux distributions, hence we must package our own libstdc++. > - However, there are other Python modules which are source distributions and > compile on the system itself hence depends on the system's existing > libtsdc++. > - Since the system will only load 1 instance of libstdc++ at a time, we > can't > merely distribute libstdc++.so. Doing so will mean whether we load correctly > or not will depend on import ordering. > - Therefore we must static link libstdc++ into our shared library. > - As a result there are actually 2 instances of libstdc++ symbols loaded > into > Python (This ought to work since Python uses RTLD_LOCAL) I think what you're doing is unsupported and unlikely to work like this. You should look into using a devtoolset compiler to avoid dependencies on symbols from the newer libstdc++. You might be able to do it yourself with a carefully crafted linker script, but that work has already been done when creating devtoolset. > Key Issue > --------- > Now, the key issue is that all [facet]::id are a UNIQUE symbol which crosses > RTLD_LOCAL boundaries, EXCEPT for ctype<char>::id, codecvt<char>::id, > ctype<wchar>::id, and codecvt<wchar>::id which are WEAK. That is surprising to me. I would expect them all to use STB_GNU_UNIQUE. > Solution > -------- > It might be easy to solve this problem for libstdc++'s going forward. Make > all > the [facet]::id variables WEAK. I don't think that's what we want. All globals should be unique.