From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by sourceware.org (Postfix) with ESMTPS id CC1DB3858D33 for ; Thu, 16 Feb 2023 20:09:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CC1DB3858D33 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-x52d.google.com with SMTP id a10so7226363edu.9 for ; Thu, 16 Feb 2023 12:09:13 -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=SloHyp7GWyASjIt85Uy2BUfkSf84yqCTuuyN/dNWxwA=; b=SmRCkqBDS8ljzf3wGkA0AtpZKmJtF7NXxj7n4heAGNgmjqyIe1DhSl8qlh4uncW/bK IJ6WxVHyw+Sc4/H+3kleATshubF5vblsDabnkTKApe3fi69g8X3ghHnGsePOACuZDrho QVEHi+9BRq+O07Ki2QZKNdafYZSerw9z/wiwdXFpede/X2RwlyBybZsc4DWbroL1Dr6h xPCUrLKRFFZrI5NnzchEiALH+F6D8g8v6UcrJK/5KDiIhUShmaUtJN8rIuNH09LzOw30 Sj6fr8P2AwscKWa2Vem5R9cVTCcPhRWyzzjGlcEyeYpakvf2kihUpHJzRoPA1k8bbH86 yk+g== 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=SloHyp7GWyASjIt85Uy2BUfkSf84yqCTuuyN/dNWxwA=; b=yWCVthO9aBwUBLcHNrZR24uSHdpo0tpqQeBtj67gc8fPXQahAnbHXmfhGt/Pwpud3F UFyuJrPBtTHRVhRFTwCO7zJPwtX6b9VLQ9GqpKtGlI72j+9r1elwn3uow2Yg6DbGT+uV kTA2p9iH6u9UU3U9VA4OoHAv/Qj9YI6w02QezFOq0opVS8wTTlmDaYmvKz8Ei3gbz8cY T4EZh0WMcwphmFMmglTxUUJTZ1koEMaKXTbJ7bg+RctngCSLAUkRuHqQl3chqV4vJnPZ aHstsX1GXP1MdXe7mOS9Sk/yM9R6/e4are2cpYJTpAV81ha9PTqS4caLL6t9MVmeiA2g 4xZA== X-Gm-Message-State: AO0yUKXdmZIMkFEp3ZqygJmY8uvXaJD524o6KjSk3rTL5YlJJYFn5tO5 pjk/3Mjeck/qoqPcwQ6+y1sqxXCVpASX2zj+wd8= X-Google-Smtp-Source: AK7set+yXgArxuSfIfeLt1LETVWytt3dD3J4Ewl9MPQuCqD0ThT3H2ApXxY5tN2GgU/mBK9Gb34YIOMv3EeYZmhPpZY= X-Received: by 2002:a50:a695:0:b0:4ac:b626:378e with SMTP id e21-20020a50a695000000b004acb626378emr3740956edc.5.1676578152477; Thu, 16 Feb 2023 12:09:12 -0800 (PST) MIME-Version: 1.0 References: <4f36cb6cb8e444073e1a9e253e861920@autistici.org> <82d48ece08fbe9d59cca0cebd8d04f58@autistici.org> In-Reply-To: <82d48ece08fbe9d59cca0cebd8d04f58@autistici.org> From: Jonathan Wakely Date: Thu, 16 Feb 2023 20:08:59 +0000 Message-ID: Subject: Re: Extra import symbol in debug build To: niXman Cc: Gcc Help Content-Type: multipart/alternative; boundary="0000000000003779a105f4d6c595" X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE,KAM_SHORT,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: --0000000000003779a105f4d6c595 Content-Type: text/plain; charset="UTF-8" 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. > > what should I do next to understand the reason? > Check which libstdc++.so.6 is being used by the executable when you're debugging it and make sure it's the one from the GCC build you're compiling with. https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dynamic_or_shared.html#manual.intro.using.linkage.dynamic Since the problem happens when debugging on a remote host, you need to make sure you have the right libstdc++.so.6 when doing that debugging. moreover, im unsure I understand the reason correctly... > > > > best! > > > > > >> > >> but I don't want to debug libstdc++, so I think I shouldn't install > >> additional debug version of libstdc++. > >> > >> it looks like a bug, or am I wrong? > >> > >> another my question is, what should I do to get rid of that extra > >> symbol > >> in Debug build? > >> > >> > >> > >> > >> best! > >> > >> ps > >> I can't update GCC nor libstdc++. > --0000000000003779a105f4d6c595--