From: Oleg Smolsky <osmolsky@netskope.com>
To: gcc-help <gcc-help@gcc.gnu.org>
Subject: Linking issue when mixing GCC10/GCC11 artifacts
Date: Mon, 28 Jun 2021 21:55:58 -0700 [thread overview]
Message-ID: <CAAucFJcVvwVedKBxjGcM+2uZsdZ6UoA8KCyX+Qa1qJctJUcbFA@mail.gmail.com> (raw)
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.
next reply other threads:[~2021-06-29 4:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-29 4:55 Oleg Smolsky [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAAucFJcVvwVedKBxjGcM+2uZsdZ6UoA8KCyX+Qa1qJctJUcbFA@mail.gmail.com \
--to=osmolsky@netskope.com \
--cc=gcc-help@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).