Bug #2853
closedGlobal variable in static library causes double free or corruption error
0%
Description
This bug happened when I use both the ndn-cxx and the ChronoSync library. (Please refer #2842 to reproduce it)
Specify compiler flag "-fvisibility=hidden" in ndn-cxx could resolve this issue, but it also introduces other ld warnings on Mac.
Updated by Junxiao Shi over 9 years ago
- Related to Bug #2842: "double free" reported when smart pointer is created outside of the wrapper class added
Updated by Davide Pesavento over 9 years ago
In #2842, Chengyu Fan wrote:
I think the reason we have this issue might be:
- Two DEFAULT_PREFIX are defined in ndn namespace in ndn-cxx library (ndn::DEFAULT_PREFIX in key-chain, ndn::nfd::DEFAULT_PREFIX in nfd-command-options), and the compiler has trouble to distinguish them.
This doesn't make sense. They are in different namespaces therefore they are different symbols, unless your compiler is doing something very wrong with name mangling.
Is ChronoSync a static or a dynamic library?
Updated by Chengyu Fan over 9 years ago
Davide Pesavento wrote:
Is ChronoSync a static or a dynamic library?
ChronoSync is a dynamic library
Updated by Davide Pesavento over 9 years ago
This is expected then. libndn-cxx.a
is linked twice, once via ChronoSync shared library and once directly in the final executable, resulting in two copies of ndn-cxx in the executable. The result is that the symbols exported by the two copies interpose each other, with obvious catastrophic consequences.
#2243 will solve this.
Updated by Chengyu Fan over 9 years ago
- Related to Task #2243: Allow building of shared library added
Updated by Chengyu Fan over 9 years ago
Davide Pesavento wrote:
#2243 will solve this.
I see. I will check it using the test code, thanks.
Updated by Junxiao Shi over 7 years ago
- Status changed from New to Rejected
This issue is due to incorrect use of the static library.