From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by sourceware.org (Postfix) with ESMTPS id B17813858C39 for ; Fri, 17 Feb 2023 11:27:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B17813858C39 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-x536.google.com with SMTP id co2so2561790edb.13 for ; Fri, 17 Feb 2023 03:27:05 -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=DGbEHFVXc0+ifNV0/CQDUmqWw+3rVsrckvXdPP9mkYw=; b=Ial/ayOAUReXM7p63cTKfbFX/ZdRSPSD9s6juTNGJ4gChMFLCfk2DmRGuH3FMHzq2P bAW53ohxthmNJIhtbIgP6v+3U5v3U+TA2fv6fFrtUYIbC3WMiuvua7q3etiiWKu0nsTn QX+F5A7o/bJn19U0NBNcWwzx2CKsGiwO3xyLzQDXxurQnMxzQ5BW3H5D9JIb/Kre7Z0J mbouL6o76jF7k+JuGg2wV6tarpCSM83cfXo/q5BJvPdACYy1aL/o+UFgyliJxtn8ulJ3 EGkOFqAARN4BFwv3sesbZnFFu2KdXNjhtkNO8Ofr2awA2+h2NUvIxl9ctI4jNwZf76YX F7zA== 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=DGbEHFVXc0+ifNV0/CQDUmqWw+3rVsrckvXdPP9mkYw=; b=C8/yYD9GO/P3l7wD2ttSYNzhSP/Yj339cpLHB1MColmbiJMlEZwoKFvvbAbom431QJ pbU2jhFHNTfZiMqAG+RRAqVe1vn9f3nrsk3CZxWhXaWBwMQIw+nH/qmJZ1Gi1hLEyfny Ux9/+qX6a/rJGuwXAlwmQ7VUEYUeEI9bnUHo3XTRvmRnlitTdZhF6voXt8c38/6OzvTk SjTZKrprdIPTW+fS0aRnxh+tEk35MZEKVblZrfzZnC8fVuIRp7RiaNJxMySDIcISad3X POw8YLxS/cEQsVqipdJ6gf0ot1cOM+xk9kqqaz3wxyf5tjJvUzSZjN96dllr4/296Uvs xsnQ== X-Gm-Message-State: AO0yUKUyqOhFEpdyWyxzMENkAq1uiIQhKM9yAYK8mgGY1FAHFbS0R42+ x8E+kNNfPcweT0mGIq6IBgPDUAs1Q4mRgDglujXS5faV X-Google-Smtp-Source: AK7set8hcj2HKqymfYQeuX+WtaQ5Dcf0CZrMZJnGmZWU8NTK6u3wt2znCqO6Rj5SOLemyOJt2tv9Mp57ymTbayddCko= X-Received: by 2002:a50:bb65:0:b0:4ac:c720:207c with SMTP id y92-20020a50bb65000000b004acc720207cmr554214ede.5.1676633224547; Fri, 17 Feb 2023 03:27:04 -0800 (PST) MIME-Version: 1.0 References: <4f36cb6cb8e444073e1a9e253e861920@autistici.org> <82d48ece08fbe9d59cca0cebd8d04f58@autistici.org> <1fa9b2598357629dfaac5debd53708b3@autistici.org> In-Reply-To: <1fa9b2598357629dfaac5debd53708b3@autistici.org> From: Jonathan Wakely Date: Fri, 17 Feb 2023 11:26:52 +0000 Message-ID: Subject: Re: Extra import symbol in debug build To: niXman Cc: Gcc Help Content-Type: multipart/alternative; boundary="000000000000c4915c05f4e397a1" 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,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: --000000000000c4915c05f4e397a1 Content-Type: text/plain; charset="UTF-8" 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++. > 2. how can I define this symbol in the project code for debug build to > avoid having to use the debug version of libstdc++? > something like this? : > namespace std { > template basic_ios >::operator bool() const; > } > > > > > best! > --000000000000c4915c05f4e397a1--