From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by sourceware.org (Postfix) with ESMTPS id D0456382F0B0 for ; Tue, 30 Aug 2022 19:24:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D0456382F0B0 Received: by mail-ed1-x530.google.com with SMTP id m1so15556242edb.7 for ; Tue, 30 Aug 2022 12:24:26 -0700 (PDT) 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; bh=9WMnokDjgXlJZwHy5FkscUj4cK9G44P9pckzOmtvGek=; b=u3Sr7ROdJOPu1r35yzIrSvy1A/tp1y/JHUtgRTfM//YDa1Pb4sVh53yKA7ZGPy+1xO zj7acDmIWa0hNdbZtDHaEhKvWRtR1Sr7ISPIS/8TyyUW1YyeuVe0NVd8f3dPAIGX++A4 /QVt0BGZpky4Ixod2q+WvfF4j2PHY8icB8DNG6oa7i9AlTWlNSd/naGjTxpYeO2nw82z Z4evfG3Z3o/MwSEjRr5c/1f5PfoozBLJdhFhQY8YWKXEtZSzAZHmlxKYuBG0HBp/bCOO bGV0Bp+vEQihBA4OxZBcO+l84oZEwjtJErbhc9YuGdz2EKNi3SYjhbyaeVeDIqn5+v0S qubQ== X-Gm-Message-State: ACgBeo2L6e5rYz/MEPHxqeaSL4cPiQJivGrk2T92lRA9pFvpPVW6M769 zabMsbbFrKB4wxXTBzT39DHgjq2sFBvnwgTEepg= X-Google-Smtp-Source: AA6agR6EQ+6vbt55abfsj0Xp5VPyz9JV9YGslWgX4iM+Lis3bHhcAR3Pdq9dQATLNVvyPbHe2puOvL/F0ddAsT/vEyk= X-Received: by 2002:a05:6402:184:b0:442:fd54:2a21 with SMTP id r4-20020a056402018400b00442fd542a21mr21557966edv.129.1661887465734; Tue, 30 Aug 2022 12:24:25 -0700 (PDT) MIME-Version: 1.0 References: <4161b707473552ce74c41c8867c2cc6d77ff4e05.camel@gmail.com> <0951c3b4584404fab95dd7d92af8b6f301b758c7.camel@gmail.com> <7d0bd41ee0e5fd9de922e35fe4d1312488635ce8.camel@gmail.com> In-Reply-To: <7d0bd41ee0e5fd9de922e35fe4d1312488635ce8.camel@gmail.com> From: Jonathan Wakely Date: Tue, 30 Aug 2022 20:24:12 +0100 Message-ID: Subject: Re: Relation between gcc version and libstdc++ version To: =?UTF-8?Q?Anton_W=C3=B6llert?= Cc: "gcc-help@gcc.gnu.org" X-Spam-Status: No, score=-0.5 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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gcc@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Aug 2022 19:24:29 -0000 On Tue, 30 Aug 2022, 19:46 Anton W=C3=B6llert, wrote= : > Thanks for your comments, > > sorry for posting on the wrong mailing list. I'll just restate my > initial question here on gcc-help again: > > I was trying to build a cross-compilation toolchain for a specific > target using a newer GCC version, than the one that the binaries > were build on the target. > > The C part seems to work well, but the C++ part doesn't. It seems > that the G++ ships it's own libstdc++ include headers. If this > libstdc++ is newer than the one one the target, I get undefined > references (because there are some newer implementation details and > things like that). Is it possible to tell G++/GCC to use the > libstdc++.so from the target and also to use the C++ headers (like > iostream) from the target? > If not, is there any reason this is hard-coded? > > With clang it looks like you can specify "any" libstdc++ version you > want, although I haven't tested it yet. > > On Tue, 2022-08-30 at 18:21 +0100, Jonathan Wakely wrote: > > This doesn't belong on this mailing list though, please use the gcc- > > help list instead. > > > > This list is for discussion of GCC development, not help using it. > > > > > > > > C++ in general > > > > tries to be very good in backward compatibility. > > > > This essentially means that you can't use newer compilers with > > > > more > > > > features/bugfixes to compile software for older targets. > > > > > > > > > No it doesn't. Using new compilers on older machines works fine. > > > You just need to do it right. > > > > > So what is the right way to compile software with a newer version of > gcc for a target, that has an older version of gcc? I can't find any > hints about that in documentation. Should I ship the newer > libstdc++.so with the application to the target and set > LD_LIBRARY_PATH? As the documentation says, there are other ways that might be better than LD_LIBRARY_PATH, but they all require shipping the new libstdc++.so.6 with the application. Static linking is another option, which avoids needing the new libstdc++.so.6 at runtime. Then I probably also have to add other libraries, > right? > No, you shouldn't need to. > > Kind regards, > Anton > > > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by sourceware.org (Postfix) with ESMTPS id D0456382F0B0 for ; Tue, 30 Aug 2022 19:24:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D0456382F0B0 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-x530.google.com with SMTP id m1so15556242edb.7 for ; Tue, 30 Aug 2022 12:24:26 -0700 (PDT) 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; bh=9WMnokDjgXlJZwHy5FkscUj4cK9G44P9pckzOmtvGek=; b=fikit9ub5iq1rNvIwrlyMQzrt5r0ReHazY5XLeal4OcpuPlA25Zk4bbr2FFkfRrpb3 r2wax4147iKix8hj1QJp7AlR4YiO1mIDb7ZEuf5nce0ZPGjbjD0Jm5sRl7e0aoIInRKp vCwEEuamrdtf/0f/3aWO4HwXtMYp+La220p2Cf8T3V1IuPv83E5pnQTpMi+w9HQGDa24 nLQk8AFe3RkjDIoj9XdyvHhuX/zh7L4KebXrBdRppMac5iXq2oYq+VbY671Q1vE4v/zp XC4dsJQjaIIirppv7Cw72D92CLmiIfonfcbswg+ZuXjnWzqg/KUnT5cKJDq1edpajqJH 1kUw== 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; bh=9WMnokDjgXlJZwHy5FkscUj4cK9G44P9pckzOmtvGek=; b=u3Sr7ROdJOPu1r35yzIrSvy1A/tp1y/JHUtgRTfM//YDa1Pb4sVh53yKA7ZGPy+1xO zj7acDmIWa0hNdbZtDHaEhKvWRtR1Sr7ISPIS/8TyyUW1YyeuVe0NVd8f3dPAIGX++A4 /QVt0BGZpky4Ixod2q+WvfF4j2PHY8icB8DNG6oa7i9AlTWlNSd/naGjTxpYeO2nw82z Z4evfG3Z3o/MwSEjRr5c/1f5PfoozBLJdhFhQY8YWKXEtZSzAZHmlxKYuBG0HBp/bCOO bGV0Bp+vEQihBA4OxZBcO+l84oZEwjtJErbhc9YuGdz2EKNi3SYjhbyaeVeDIqn5+v0S qubQ== X-Gm-Message-State: ACgBeo2L6e5rYz/MEPHxqeaSL4cPiQJivGrk2T92lRA9pFvpPVW6M769 zabMsbbFrKB4wxXTBzT39DHgjq2sFBvnwgTEepg= X-Google-Smtp-Source: AA6agR6EQ+6vbt55abfsj0Xp5VPyz9JV9YGslWgX4iM+Lis3bHhcAR3Pdq9dQATLNVvyPbHe2puOvL/F0ddAsT/vEyk= X-Received: by 2002:a05:6402:184:b0:442:fd54:2a21 with SMTP id r4-20020a056402018400b00442fd542a21mr21557966edv.129.1661887465734; Tue, 30 Aug 2022 12:24:25 -0700 (PDT) MIME-Version: 1.0 References: <4161b707473552ce74c41c8867c2cc6d77ff4e05.camel@gmail.com> <0951c3b4584404fab95dd7d92af8b6f301b758c7.camel@gmail.com> <7d0bd41ee0e5fd9de922e35fe4d1312488635ce8.camel@gmail.com> In-Reply-To: <7d0bd41ee0e5fd9de922e35fe4d1312488635ce8.camel@gmail.com> From: Jonathan Wakely Date: Tue, 30 Aug 2022 20:24:12 +0100 Message-ID: Subject: Re: Relation between gcc version and libstdc++ version To: =?UTF-8?Q?Anton_W=C3=B6llert?= Cc: "gcc-help@gcc.gnu.org" Content-Type: multipart/alternative; boundary="0000000000000d49c705e77a544e" X-Spam-Status: No, score=-0.5 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,T_SCC_BODY_TEXT_LINE 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: Message-ID: <20220830192412.2uWwpQtZ2Vqg1sVGojmMNMmNvJn9lf4l4dGjSasB33k@z> --0000000000000d49c705e77a544e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, 30 Aug 2022, 19:46 Anton W=C3=B6llert, wrote: > Thanks for your comments, > > sorry for posting on the wrong mailing list. I'll just restate my > initial question here on gcc-help again: > > I was trying to build a cross-compilation toolchain for a specific > target using a newer GCC version, than the one that the binaries > were build on the target. > > The C part seems to work well, but the C++ part doesn't. It seems > that the G++ ships it's own libstdc++ include headers. If this > libstdc++ is newer than the one one the target, I get undefined > references (because there are some newer implementation details and > things like that). Is it possible to tell G++/GCC to use the > libstdc++.so from the target and also to use the C++ headers (like > iostream) from the target? > If not, is there any reason this is hard-coded? > > With clang it looks like you can specify "any" libstdc++ version you > want, although I haven't tested it yet. > > On Tue, 2022-08-30 at 18:21 +0100, Jonathan Wakely wrote: > > This doesn't belong on this mailing list though, please use the gcc- > > help list instead. > > > > This list is for discussion of GCC development, not help using it. > > > > > > > > C++ in general > > > > tries to be very good in backward compatibility. > > > > This essentially means that you can't use newer compilers with > > > > more > > > > features/bugfixes to compile software for older targets. > > > > > > > > > No it doesn't. Using new compilers on older machines works fine. > > > You just need to do it right. > > > > > So what is the right way to compile software with a newer version of > gcc for a target, that has an older version of gcc? I can't find any > hints about that in documentation. Should I ship the newer > libstdc++.so with the application to the target and set > LD_LIBRARY_PATH? As the documentation says, there are other ways that might be better than LD_LIBRARY_PATH, but they all require shipping the new libstdc++.so.6 with the application. Static linking is another option, which avoids needing the new libstdc++.so.6 at runtime. Then I probably also have to add other libraries, > right? > No, you shouldn't need to. > > Kind regards, > Anton > > > --0000000000000d49c705e77a544e--