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 5A8823852741 for ; Tue, 30 Aug 2022 16:09:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5A8823852741 Received: by mail-ed1-x52f.google.com with SMTP id z2so14884515edc.1 for ; Tue, 30 Aug 2022 09:09:58 -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=ZRLuBH9ZBYgNtIBbuu+vOl5f1Nvo296e5bs36cc+VD4=; b=GD2OJWlVxsk+HGkqsU6fPgG9J4FPfeySoxOcLDS6SQ9Jn86RDi0lLQTT8kPZREOsHs 9ef8t8b9MgDSNe7nOYU5+4UJYfxXabrf6mtb5Fcwp/hrqJuyhwpT/XkvpNQ2eSjyllTQ U9esbtWEdjXYv/cdjscydfhPDYzjP7Q+jalKBXNBDYKe1/LWwIJnNbulkI2iE3OdV8M4 H1In8558JYAgBKAwnty5VmKn/GAmJ8rOzpMabLVps1Erib+vORpGsMoI1l5AovVE2Vpg ROXaBKg5eVZqCHkaXBdOLQjYHkzMR6ZcJ4kf6pn27+kYw6MXkpspRzk1ZDePAjZf9JaI RJFg== X-Gm-Message-State: ACgBeo1Oy5VVNC1+30vtisYS6T+qiScC3jmC+T8u6PlwRFQXcKiA8Oo4 phVvz/g8jXk3IeplSKuJZWWGdQO2HIaGMvo3aOs= X-Google-Smtp-Source: AA6agR7VEgcfdIW2vsxeaFVD+NmwUt8v4/muLvByNnBfZ9qlyRwhI/mcFAv7K4xQ22gtYvERfpT7hSOdVfnayHapO8M= X-Received: by 2002:aa7:dc17:0:b0:441:e5fc:7f91 with SMTP id b23-20020aa7dc17000000b00441e5fc7f91mr20914058edu.301.1661875796687; Tue, 30 Aug 2022 09:09:56 -0700 (PDT) MIME-Version: 1.0 References: <4161b707473552ce74c41c8867c2cc6d77ff4e05.camel@gmail.com> In-Reply-To: <4161b707473552ce74c41c8867c2cc6d77ff4e05.camel@gmail.com> From: Jonathan Wakely Date: Tue, 30 Aug 2022 17:09:42 +0100 Message-ID: Subject: Re: Relation between gcc version and libstdc++ version To: =?UTF-8?Q?Anton_W=C3=B6llert?= Cc: "gcc@gcc.gnu.org" 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, KAM_SHORT, 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 16:10:02 -0000 On Tue, 30 Aug 2022, 15:48 Anton W=C3=B6llert via Gcc, wr= ote: > Hello list! > > 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. Yes, because libstdc++ is part of GCC. 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). Then you're not telling the executable how find the new libstdc++. https://gcc.gnu.org/onlinedocs/libstdc++/faq.html#faq.how_to_set_paths 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? > It's possible, but unsupported and probably won't work. If not, is there any reason this is hard-coded? > The libstdc++ headers are tightly coupled to the GCC version, so headers from a given GCC release might not even compile with a newer or older GCC. 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 5A8823852741 for ; Tue, 30 Aug 2022 16:09:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5A8823852741 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 z2so14884515edc.1 for ; Tue, 30 Aug 2022 09:09:58 -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=ZRLuBH9ZBYgNtIBbuu+vOl5f1Nvo296e5bs36cc+VD4=; b=GEOjhO7kzjDigmlL7XN0a+0xP9+3nHQO/6LHA9NY+tbOw7sONqTqtIimDNOkCB8j/P quPm/FwN/5X8jFZqKhyhARQqHzPyPhVN0QKXOS4b39PLwiNqFKo81DNF3MdmqdXKblts oRVBwjaQPkQp2ltumd2WaSw6OYKvlVz+OTrapYRqECSiX5DIESo03mCqQtjjpU89s0r+ Wj2/S3+X2ZN+SgNFXTHAxonpXrKO1nyJ6JJZyoBjJcOMOKSX1iHEYU5rtVM1dm0j+JE8 /tQRS7gqhtsqEMWYMCu1knT/LILbATkyFY5TsnwuYAWXx8wOm1ezOhiKyF25Pp6MNPGc ZkMA== 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=ZRLuBH9ZBYgNtIBbuu+vOl5f1Nvo296e5bs36cc+VD4=; b=GD2OJWlVxsk+HGkqsU6fPgG9J4FPfeySoxOcLDS6SQ9Jn86RDi0lLQTT8kPZREOsHs 9ef8t8b9MgDSNe7nOYU5+4UJYfxXabrf6mtb5Fcwp/hrqJuyhwpT/XkvpNQ2eSjyllTQ U9esbtWEdjXYv/cdjscydfhPDYzjP7Q+jalKBXNBDYKe1/LWwIJnNbulkI2iE3OdV8M4 H1In8558JYAgBKAwnty5VmKn/GAmJ8rOzpMabLVps1Erib+vORpGsMoI1l5AovVE2Vpg ROXaBKg5eVZqCHkaXBdOLQjYHkzMR6ZcJ4kf6pn27+kYw6MXkpspRzk1ZDePAjZf9JaI RJFg== X-Gm-Message-State: ACgBeo1Oy5VVNC1+30vtisYS6T+qiScC3jmC+T8u6PlwRFQXcKiA8Oo4 phVvz/g8jXk3IeplSKuJZWWGdQO2HIaGMvo3aOs= X-Google-Smtp-Source: AA6agR7VEgcfdIW2vsxeaFVD+NmwUt8v4/muLvByNnBfZ9qlyRwhI/mcFAv7K4xQ22gtYvERfpT7hSOdVfnayHapO8M= X-Received: by 2002:aa7:dc17:0:b0:441:e5fc:7f91 with SMTP id b23-20020aa7dc17000000b00441e5fc7f91mr20914058edu.301.1661875796687; Tue, 30 Aug 2022 09:09:56 -0700 (PDT) MIME-Version: 1.0 References: <4161b707473552ce74c41c8867c2cc6d77ff4e05.camel@gmail.com> In-Reply-To: <4161b707473552ce74c41c8867c2cc6d77ff4e05.camel@gmail.com> From: Jonathan Wakely Date: Tue, 30 Aug 2022 17:09:42 +0100 Message-ID: Subject: Re: Relation between gcc version and libstdc++ version To: =?UTF-8?Q?Anton_W=C3=B6llert?= Cc: "gcc@gcc.gnu.org" Content-Type: multipart/alternative; boundary="00000000000085be7205e7779ce7" 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,KAM_SHORT,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: <20220830160942.3Q9fNPcY6vM85OryBjRFT4vjfPIWySfU4yH5tHfWBGI@z> --00000000000085be7205e7779ce7 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, 30 Aug 2022, 15:48 Anton W=C3=B6llert via Gcc, wr= ote: > Hello list! > > 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. Yes, because libstdc++ is part of GCC. 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). Then you're not telling the executable how find the new libstdc++. https://gcc.gnu.org/onlinedocs/libstdc++/faq.html#faq.how_to_set_paths 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? > It's possible, but unsupported and probably won't work. If not, is there any reason this is hard-coded? > The libstdc++ headers are tightly coupled to the GCC version, so headers from a given GCC release might not even compile with a newer or older GCC. --00000000000085be7205e7779ce7--