public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Linking issue when mixing GCC10/GCC11 artifacts
@ 2021-06-29  4:55 Oleg Smolsky
  2021-06-29  5:32 ` Jonathan Wakely
  0 siblings, 1 reply; 10+ messages in thread
From: Oleg Smolsky @ 2021-06-29  4:55 UTC (permalink / raw)
  To: gcc-help

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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-06-29 23:04 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-29  4:55 Linking issue when mixing GCC10/GCC11 artifacts Oleg Smolsky
2021-06-29  5:32 ` Jonathan Wakely
2021-06-29 15:39   ` [EXTERNAL] " Oleg Smolsky
2021-06-29 15:42     ` Oleg Smolsky
2021-06-29 16:24       ` Oleg Smolsky
2021-06-29 16:40         ` Jonathan Wakely
2021-06-29 16:50           ` Jonathan Wakely
2021-06-29 16:57           ` Oleg Smolsky
2021-06-29 17:22             ` Jonathan Wakely
2021-06-29 23:04               ` Oleg Smolsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).