public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Oleg Smolsky <osmolsky@netskope.com>
To: Jonathan Wakely <jwakely.gcc@gmail.com>
Cc: gcc-help <gcc-help@gcc.gnu.org>
Subject: Re: [EXTERNAL] Re: Linking issue when mixing GCC10/GCC11 artifacts
Date: Tue, 29 Jun 2021 08:39:54 -0700	[thread overview]
Message-ID: <CAAucFJck7_=mvvt4ekQ9RuHT6XB++CHtxDDgK=7q5jB3SFrnwQ@mail.gmail.com> (raw)
In-Reply-To: <CAH6eHdRUF+jfaJa1QU8aentWfk_rU1tZDxo=RRh+ixkNfXk0Mg@mail.gmail.com>

I am using `g++` to link in both working and failing cases.

Oleg.

On Mon, Jun 28, 2021 at 10:32 PM Jonathan Wakely <jwakely.gcc@gmail.com>
wrote:

>
>
> On Tue, 29 Jun 2021, 05:58 Oleg Smolsky via Gcc-help, <
> gcc-help@gcc.gnu.org> wrote:
>
>> 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?
>>
>
> Are you using 'gcc' to link, not 'g++'?
>
>
>

  reply	other threads:[~2021-06-29 15:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-29  4:55 Oleg Smolsky
2021-06-29  5:32 ` Jonathan Wakely
2021-06-29 15:39   ` Oleg Smolsky [this message]
2021-06-29 15:42     ` [EXTERNAL] " 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='CAAucFJck7_=mvvt4ekQ9RuHT6XB++CHtxDDgK=7q5jB3SFrnwQ@mail.gmail.com' \
    --to=osmolsky@netskope.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=jwakely.gcc@gmail.com \
    /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).