From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from confino.investici.org (confino.investici.org [IPv6:2a11:7980:1::2:0]) by sourceware.org (Postfix) with ESMTPS id E12CB3858C31 for ; Fri, 17 Feb 2023 08:51:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E12CB3858C31 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=autistici.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=autistici.org Received: from 1.mail-backend.investici.org (unknown [10.0.0.11]) by confino.investici.org (Postfix) with ESMTP id 4PJ5C60lkXz11JN; Fri, 17 Feb 2023 08:51:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1676623890; bh=q4DdlKTKUwzN/Z9GAmid/tqwz/b6aS60faEyZJA+9p8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=LBcPsUis+1teC9krCdlMjMUaMA597QPxZ6xK9ISEEu9RllLUHF5aSoFUkc6Jcjdi5 m2tmL6dM8HQpLhhclJCZk0CGViXRKudqidlforYa1PX8Px8Cyw7ncEcmu69ES3/gi1 11e8uD49Ju3mOVBtZgvo6hd8NBjXJIomE9ncubAw= Received: from 1.webmail.investici.org (localhost [127.0.0.1]) (Authenticated sender: i.nixman@autistici.org) by 1.mail-backend.investici.org (Postfix) with ESMTPA id 4PJ5C563tvz5w3C; Fri, 17 Feb 2023 08:51:29 +0000 (UTC) MIME-Version: 1.0 Date: Fri, 17 Feb 2023 08:51:29 +0000 From: i.nixman@autistici.org To: Jonathan Wakely Cc: Gcc Help Subject: Re: Extra import symbol in debug build In-Reply-To: References: <4f36cb6cb8e444073e1a9e253e861920@autistici.org> <82d48ece08fbe9d59cca0cebd8d04f58@autistici.org> User-Agent: Roundcube Webmail Message-ID: <1fa9b2598357629dfaac5debd53708b3@autistici.org> X-Sender: i.nixman@autistici.org Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,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: 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? 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!