From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by sourceware.org (Postfix) with ESMTPS id 8581B3858C39 for ; Fri, 17 Feb 2023 12:06:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8581B3858C39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-x52f.google.com with SMTP id ez12so3428473edb.1 for ; Fri, 17 Feb 2023 04:06:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=96Jk9K/8BZEBp9E8mTBwb1ojnwGOt6deXS/GfPgaANg=; b=AtJ3c+2ZGfUWRTv9dLRW8Ip88wWAKnhGVakNw63sQY1jbZw1Lex5gfyeUD7ScHU92A gaKYqrSMlfUaaLJobN+P6Hm26/wRO/HmJQP7sKbuZiHzAOSyweHKK19AI3ckj0I/I7xG PUdcObaWCg2WxvNVDW7Z1TEefoTnzUYoSHCpjwEX2OUpBAVZVF0if76TjhonvZ22dSDk sDhqHRAaZJrcExv1cngWu8j+uFSxt4Ft9XgvEmOKOEw9iKCJc8ZWy02Ecf8pvWqAKXqB TdwkC/aYZzyHAf4N+fk1UONI5smxsvbxGuVVVsyknVDwVtdKxL5VLQa01gbIOGZ0Vd8b 6XYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=96Jk9K/8BZEBp9E8mTBwb1ojnwGOt6deXS/GfPgaANg=; b=MNBbClz89TlHZHCJqr6GmgrDKGkDxPoiLcWuIGTd6Xkz+gdV2LS+I63sR4FkYdCSsS tXWDuRkWWK6idMQy7uAYRjXrfD+c/jcXX6/c4DPVP9qqwfIU7bI0ULOf20SfzGsTqseP LAznp+OG48IPLLk+7y4ntuhBqNffkmLqY5B27YenGarSYbSz94oBLJmiiYWih1ikWGpn R8OW9nfQDKxEHJC+LSEgVXHpQDEQWqM3zUAXbuDpX25J5RTo6RuVe3BaLWcpXBuiE3pw hWsQg/f+yfIKu9OmsqCzknigGS46uBE0kCHmFaIngMbrnIBFS512XkujR3nw/XErP0fX G1sQ== X-Gm-Message-State: AO0yUKU33N7Ho9nSritx9f4l4X0zNl4/3lJrdEJqrjtrZHgPIUGqU6dc 0HK+r1cR6udK4PbVP1vHYsnVgkN9u8h4Rng1MHti3IUZ X-Google-Smtp-Source: AK7set85DNdPpkxbaKPRyO5Xc+Pa/u+8Fn/XDoD/QK7D3QWdkqAOkW+3n0ijNOF4GxDiHX/mfgZEC7B1ec4l0utU35I= X-Received: by 2002:a17:907:20ae:b0:877:7480:c76a with SMTP id pw14-20020a17090720ae00b008777480c76amr245973ejb.13.1676635618281; Fri, 17 Feb 2023 04:06:58 -0800 (PST) MIME-Version: 1.0 References: <4f36cb6cb8e444073e1a9e253e861920@autistici.org> <82d48ece08fbe9d59cca0cebd8d04f58@autistici.org> <1fa9b2598357629dfaac5debd53708b3@autistici.org> <1abbf26093a9b47c837b2d304b9fa15d@autistici.org> In-Reply-To: <1abbf26093a9b47c837b2d304b9fa15d@autistici.org> From: Jonathan Wakely Date: Fri, 17 Feb 2023 12:06:45 +0000 Message-ID: Subject: Re: Extra import symbol in debug build To: niXman Cc: Gcc Help Content-Type: multipart/alternative; boundary="000000000000720e3105f4e42697" X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --000000000000720e3105f4e42697 Content-Type: text/plain; charset="UTF-8" On Fri, 17 Feb 2023, 11:32 , wrote: > On 2023-02-17 11:26, Jonathan Wakely wrote: > > On Fri, 17 Feb 2023, 08:51 , wrote: > > > >> On 2023-02-16 20:08, Jonathan Wakely wrote: > >> > On Thu, 16 Feb 2023, 18:39 , wrote: > >> > > >> >> On 2023-02-16 15:29, Jonathan Wakely wrote: > >> >> > On Thu, 16 Feb 2023 at 15:25, i.nixman--- via Gcc-help > >> >> > wrote: > >> >> >> > >> >> >> hello, > >> >> >> > >> >> >> > >> >> >> I can successfully build the same C++ code using GCC-8.3.1 for > Debug > >> >> >> (-g > >> >> >> -O0) and Release (-g -O2) build. > >> >> >> I can successfully debug the Release-executable on a remote host, > but > >> >> >> I > >> >> >> can't debug the Debug-executable on a remote host, because the > >> >> >> Debug-executable imports an extra symbol > >> >> >> _ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv from libstdc++ which > >> >> >> doesn't > >> >> >> exist. > >> >> > > >> >> > It should exist, it has been there since GCC > >> >> > >> >> hmm... > >> >> > >> >> I just checked the two binaries using this cmd: > >> >> > >> >> > readelf -sW executable | grep > >> >> > _ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv > >> >> > >> >> it shows nothing for release build, and shows this for debug build: > >> >> > >> >> > 54: 0000000000000000 0 FUNC GLOBAL DEFAULT UND > >> >> > _ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv > >> >> > 199898: 0000000000000000 0 FUNC GLOBAL DEFAULT UND > >> >> > _ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv > >> >> > >> > > >> > > >> > This only shows that the function is inlined in the optimized build, > >> > and > >> > not in the debug build, so the debug one has an unresolved reference > to > >> > a > >> > symbol defined in the libstdc++ dynamic library. This is completely > >> > normal. > >> > > >> > >> then I have two questions: > >> > >> 1. will the problem be solved by "pushing" a debug version of > >> libstdc++ > >> on the remote machine? > >> > > > > You don't need a debug version, the symbol is present in all builds of > > libstdc++. > > hmm.. > but I can't confirm that using this cmd: > readelf -sW /lib64/libstdc++.so.6 | grep > _ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv > That suggests either you built it wrong, or that library is from an older GCC, not the one you're compiling with. --000000000000720e3105f4e42697--