Linking libstdc++ statically: any gotchas?

后端 未结 5 1228
北恋
北恋 2020-11-27 09:16

I need to deploy a C++ application built on Ubuntu 12.10 with GCC 4.7\'s libstdc++ to systems running Ubuntu 10.04, which comes with a considerably older version of libstdc+

5条回答
  •  清酒与你
    2020-11-27 09:58

    One addition to Jonathan Wakely's excellent answer, why dlopen() is problematic:

    Due to the new exception handling pool in GCC 5 (see PR 64535 and PR 65434), if you dlopen and dlclose a library that is statically linked to libstdc++, you will get a memory leak (of the pool object) each time. So if there's any chance that you'll ever use dlopen, it seems like a really bad idea to statically link libstdc++. Note that this is a real leak as opposed to the benign one mentioned in PR 65434.

提交回复
热议问题