Linking issue when mixing GCC10/GCC11 artifacts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, I've just hit a peculiar linking issue when using std::unordered_map,
C++17 and mixing some shared libs built with GCC10/11. Here is the linking
issue:

test.o: In function `__gnu_cxx::new_allocator<std:
:__detail::_Hash_node_base*>::allocate(unsigned long, void const*)':
/opt/gcc-11/include/c++/11.1.0/ext/new_allocator.h:110: undefined reference
to `std::__throw_bad_array_new_length()'
collect2: error: ld returned 1 exit status

The reproducer looks benign to me:

struct Thing { int a, b, c; };
 int main(int argc, char **argv) {
    std::unordered_map<unsigned int, Thing *> map;
    map[1] = new Thing;
}

I hit the linking issue when the reproducer is built with GCC11 and I
link libzmq.so.3 that was built with GCC10. This is all happening on a
64-bit Linux VM and I built both compilers on the same OS (Ubuntu 16). The
issue goes away when I rebuild the 3rd-party lib with GCC11... yet I am
failing to understand why this is happening... Is this an oversight in
libstdc++ that results in an ABI break?

Thanks in advance,
Oleg.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux