From patchwork Fri Jan 17 03:08:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Leo_Nikkil=C3=A4?= X-Patchwork-Id: 37095 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id B22B327BBEA; Fri, 17 Jan 2025 03:12:14 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 8730327BBE2 for ; Fri, 17 Jan 2025 03:12:13 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tYcmB-0005aW-L9; Thu, 16 Jan 2025 22:12:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tYcmA-0005aN-Cz for guix-patches@gnu.org; Thu, 16 Jan 2025 22:12:02 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tYcmA-00078X-31 for guix-patches@gnu.org; Thu, 16 Jan 2025 22:12:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:Subject; bh=ibpRKUv4H9jqrGoA3ps2MVsdRYDOapNlnnGApm+pFGQ=; b=VWPGL9m5dNK8zccuC7T1cketrTHdFOoV8NmF42QkjpoDSNux4DcW9vT+qpxWaGKqlwzOPI3hBCobTnn95Imbn09ZxGDjO0lHvBgtcEwrtZD5uxGGkgo50c71NapZILzwdboD6nALYvPIpheMsWjON0WrKdPQnxwc4PqsnEpSWGe2Ix55oluxeu1kSEYPrIWJa8EfipM5BQTbYc1ozxXukHOFejt6jI8fjAmTCCbf6b50bw3CNFHN8wNlZJm8U5FhXJPTjBiArXi6IxfZaNBvhUzxptW1h73Cso9ZwCDbgcW3yWaobDpTzkPRKy412Xt63T69AXB6B6g7m9EjW9RDxg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tYcm9-00057X-UG for guix-patches@gnu.org; Thu, 16 Jan 2025 22:12:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#75620] [PATCH core-packages-team] gnu: gcc-6: Use libstdc++ headers appropriate for each GCC. Resent-From: Leo =?utf-8?q?Nikkil=C3=A4?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 17 Jan 2025 03:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 75620 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 75620@debbugs.gnu.org Cc: Leo =?utf-8?q?Nikkil=C3=A4?= X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.173708347019608 (code B ref -1); Fri, 17 Jan 2025 03:12:01 +0000 Received: (at submit) by debbugs.gnu.org; 17 Jan 2025 03:11:10 +0000 Received: from localhost ([127.0.0.1]:35461 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tYclJ-00056B-JC for submit@debbugs.gnu.org; Thu, 16 Jan 2025 22:11:10 -0500 Received: from lists.gnu.org ([2001:470:142::17]:34170) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tYclH-00055t-Am for submit@debbugs.gnu.org; Thu, 16 Jan 2025 22:11:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tYclB-0005YZ-VL for guix-patches@gnu.org; Thu, 16 Jan 2025 22:11:02 -0500 Received: from fhigh-a7-smtp.messagingengine.com ([103.168.172.158]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tYcl9-000757-OI for guix-patches@gnu.org; Thu, 16 Jan 2025 22:11:01 -0500 Received: from phl-compute-08.internal (phl-compute-08.phl.internal [10.202.2.48]) by mailfhigh.phl.internal (Postfix) with ESMTP id 23D3811401F6; Thu, 16 Jan 2025 22:10:57 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-08.internal (MEProxy); Thu, 16 Jan 2025 22:10:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lnikki.la; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:message-id:mime-version:reply-to :subject:subject:to:to; s=fm3; t=1737083457; x=1737169857; bh=ib pRKUv4H9jqrGoA3ps2MVsdRYDOapNlnnGApm+pFGQ=; b=nGJj+fcogswTrv8TUy ui64xk8k+543/7j2MVrEPIdtvALq5zHJ8LXS/a7gtUjm0bmk8N9yGvYmAEOf1pVA e6PYYWyEY+31yjleERxQXhHqsXG9sCUAlnwxL1izuLgqJn085XWZuT1lBtAM3++d SMT2BHLGC54GmpjtCYtrzaGW6+IR3X58ZNLrniJsvlM4zmi3/Se/cp2p4IPdhjD1 Xzy0d+CvV3eXN93rfjQcd1asW2/rjDpFxmFUQb5GD0UH3RjrmX5QcPrk8t7Jjawz c1AVvPQoovHicFBCZQwrfiW8dqbaD9Jkd3uOp/XvDWr6N3gWfxYRgcPzwwnrqTh7 H0Nw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:message-id:mime-version:reply-to:subject :subject:to:to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1737083457; x=1737169857; bh=ibpRKUv4H9jqrGoA3ps2MVsdRYDO apNlnnGApm+pFGQ=; b=UnSOqxjNck2RXy8w6ADceZDw4cuzJ4vYWXWl0M7qfnxt n0B8g66kO0jwBMYWvXFsIKzjItZ80m4RN02k42PSrXA7JhuVMxe+duqMwZYD85iz LfVlnzdUtCjSgTJASQY0kGmJMPDnPCFQ7j6JWb8/qzitEPqNc2vZzn+oFjVNCZD8 HbpCpWT9LQp+LoqaddNTMjYYekeWhxSTCtJKLN8F0fkkPIfVZYINEa1+f/Ci7U1/ 1XOeo6bTpfJRWKk+eot6kT1Yfe42eA1y27zL3Q1uC8TcVrqSoqXhFpK+JcfwdQji wToHC1wtFYDYhQY1ENY4u7U7uxxozN+ow6c7VhcJeA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudeivddgheehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevuf ffkffogggtgfesthhqredtredtjeenucfhrhhomhepnfgvohcupfhikhhkihhlmocuoehh vghllhhosehlnhhikhhkihdrlhgrqeenucggtffrrghtthgvrhhnpeegheehheeuffeuhe egheetfeetheejveegjeefheeguefghfdtgefhfeeihfevudenucffohhmrghinhepghhn uhdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehhvghllhhosehlnhhikhhkihdrlhgrpdhnsggprhgtphhtthhopedvpdhmohguvgep shhmthhpohhuthdprhgtphhtthhopehguhhigidqphgrthgthhgvshesghhnuhdrohhrgh dprhgtphhtthhopehhvghllhhosehlnhhikhhkihdrlhgr X-ME-Proxy: Feedback-ID: i41f146a7:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 16 Jan 2025 22:10:56 -0500 (EST) Date: Fri, 17 Jan 2025 05:08:49 +0200 Message-ID: <20250117030954.2640-1-hello@lnikki.la> X-Mailer: git-send-email 2.47.1 MIME-Version: 1.0 Received-SPF: pass client-ip=103.168.172.158; envelope-from=hello@lnikki.la; helo=fhigh-a7-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Leo =?utf-8?q?Nikkil=C3=A4?= X-ACL-Warn: , =?utf-8?q?Leo_Nikkil=C3=A4_via_Guix-patches?= X-Patchwork-Original-From: =?utf-8?q?Leo_Nikkil=C3=A4_via_Guix-patches?= via From: =?utf-8?q?Leo_Nikkil=C3=A4?= Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches After the "hack" introduced for , all GCCs are built with the current GCC's libstdc++ headers. This results in subtly broken C++ headers in older versions, which aren't necessarily compatible with libstdc++s from other versions. For example, this test case works with GCC 11: $ guix shell --container --emulate-fhs --pure -e '(@ (gnu packages gcc) gcc)' binutils -- sh -c 'echo -e "#include \nint main() { return std::isnan(0); }" | g++ -x c++ -; echo $?' 0 but fails with GCC 9: $ guix shell --container --emulate-fhs --pure -e '(@ (gnu packages gcc) gcc-9)' binutils -- sh -c 'echo -e "#include \nint main() { return std::isnan(0); }" | g++ -x c++ -; echo $?' In file included from /gnu/store/gkh2rljdrnj24q1q7baa6bhb119251w4-profile/include/c++/cmath:45, from :1: : In function 'int main()': :2:26: error: '__builtin_isnan' is not a member of 'std'; did you mean '__builtin_isnan'? : note: '__builtin_isnan' declared here 1 This specific error can be traced back to the GCC build, where GCC 10 and 11 are configured with: checking for ISO C99 support in for C++11... yes but GCC 9 is configured with: checking for ISO C99 support in for C++11... no The configure check fails due to errors like these due to the mismatched libstdc++: configure:17817: checking for ISO C99 support in for C++11 configure:17886: /tmp/guix-build-gcc-9.5.0.drv-0/build/./gcc/xgcc -shared-libgcc -B/tmp/guix-build-gcc-9.5.0.drv-0/build/./gcc -nostdinc++ -L/tmp/guix-build-gcc-9.5.0.drv-0/build/aarch64-unknown-linux-gnu/libstdc++-v3/src -L/tmp/guix-build-gcc-9.5.0.drv-0/build/aarch64-unknown-linux-gnu/libstdc++-v3/src/.libs -L/tmp/guix-build-gcc-9.5.0.drv-0/build/aarch64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs -B/gnu/store/l9a96zpznir4bm02lsycj35q0pakln32-gcc-9.5.0/aarch64-unknown-linux-gnu/bin/ -B/gnu/store/l9a96zpznir4bm02lsycj35q0pakln32-gcc-9.5.0/aarch64-unknown-linux-gnu/lib/ -isystem /gnu/store/l9a96zpznir4bm02lsycj35q0pakln32-gcc-9.5.0/aarch64-unknown-linux-gnu/include -isystem /gnu/store/l9a96zpznir4bm02lsycj35q0pakln32-gcc-9.5.0/aarch64-unknown-linux-gnu/sys-include -fchecking=1 -o conftest -g -O2 -D_GNU_SOURCE -std=c++11 -fno-exceptions -B/gnu/store/3gvs8sw95ldfypr1n688svl5brwdmdi9-glibc-2.39/lib -Wl,-dynamic-linker -Wl,/gnu/store/3gvs8sw95ldfypr1n688svl5brwdmdi9-glibc-2.39/lib/ld-linux-aarch64.so.1 conftest.cpp -lm >&5 In file included from /gnu/store/y3kk0ybf7hqwndl8xpm61r4a5b3lhwix-libstdc++-11.4.0/include/cmath:41, from /gnu/store/y3kk0ybf7hqwndl8xpm61r4a5b3lhwix-libstdc++-11.4.0/include/math.h:36, from conftest.cpp:41: /gnu/store/y3kk0ybf7hqwndl8xpm61r4a5b3lhwix-libstdc++-11.4.0/include/bits/c++config.h:491:18: error: missing binary operator before token "(" 491 | #if __has_builtin(__builtin_is_constant_evaluated) | ^ In file included from /gnu/store/y3kk0ybf7hqwndl8xpm61r4a5b3lhwix-libstdc++-11.4.0/include/cmath:41, from /gnu/store/y3kk0ybf7hqwndl8xpm61r4a5b3lhwix-libstdc++-11.4.0/include/math.h:36, from conftest.cpp:41: /gnu/store/y3kk0ybf7hqwndl8xpm61r4a5b3lhwix-libstdc++-11.4.0/include/bits/c++config.h:732:25: error: missing binary operator before token "(" 732 | #if _GLIBCXX_HAS_BUILTIN(__has_unique_object_representations) | ^ /gnu/store/y3kk0ybf7hqwndl8xpm61r4a5b3lhwix-libstdc++-11.4.0/include/bits/c++config.h:736:25: error: missing binary operator before token "(" 736 | #if _GLIBCXX_HAS_BUILTIN(__is_aggregate) | ^ /gnu/store/y3kk0ybf7hqwndl8xpm61r4a5b3lhwix-libstdc++-11.4.0/include/bits/c++config.h:740:25: error: missing binary operator before token "(" 740 | #if _GLIBCXX_HAS_BUILTIN(__builtin_is_constant_evaluated) | ^ /gnu/store/y3kk0ybf7hqwndl8xpm61r4a5b3lhwix-libstdc++-11.4.0/include/bits/c++config.h:744:25: error: missing binary operator before token "(" 744 | #if _GLIBCXX_HAS_BUILTIN(__is_same) | ^ /gnu/store/y3kk0ybf7hqwndl8xpm61r4a5b3lhwix-libstdc++-11.4.0/include/bits/c++config.h:748:25: error: missing binary operator before token "(" 748 | #if _GLIBCXX_HAS_BUILTIN(__builtin_launder) | ^ configure:17886: $? = 1 Updating libstdc++ to reference each GCC works around this. I've tested this with GCC 9, but I swapped the `libstdc++-headers' input directly as I didn't have the time to do a `guix pull'. I wrote this little test however to check that `this-package' should work here: (use-modules (guix build-system trivial) (guix gexp) (guix packages)) (define (make-requirement pkg) (define builder #~(call-with-output-file #$output (lambda (port) (format port "~a~%" #$(package-name pkg))))) (computed-file "requirement" builder)) (define package-1 (package (name "package-1") (version "1") (source #f) (build-system trivial-build-system) (inputs `(("requirement" ,(make-requirement this-package)))) (arguments '(#:builder (copy-file (assoc-ref %build-inputs "requirement") %output))) (synopsis #f) (description #f) (home-page #f) (license #f))) (define package-2 (package (inherit package-1) (name "package-2") (version "2"))) (list package-1 package-2) Building these packages results in the expected output, where each package uses an input customised for it: $ cat $(guix build -f this-package.scm) package-2 package-1 * gnu/packages/gcc.scm (libstdc++, libstdc++-headers): Remove variables. (make-libstdc++-headers): New procedure. (gcc-6)[native-inputs]: Use it with `this-package'. --- gnu/packages/gcc.scm | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm index 6247919fec4..3735a9c9d94 100644 --- a/gnu/packages/gcc.scm +++ b/gnu/packages/gcc.scm @@ -17,6 +17,7 @@ ;;; Copyright © 2023 Bruno Victal ;;; Copyright © 2023 Maxim Cournoyer ;;; Copyright © 2024 Nguyễn Gia Phong +;;; Copyright © 2025 Leo Nikkilä ;;; ;;; This file is part of GNU Guix. ;;; @@ -549,7 +550,7 @@ (define-public gcc-6 ;; XXX: This gross hack allows us to have libstdc++'s ;; in the search path, thereby avoiding misconfiguration of libstdc++: ;; . - ("libstdc++" ,libstdc++-headers) + ("libstdc++" ,(make-libstdc++-headers this-package)) ,@(package-inputs gcc-4.7))))) @@ -1055,31 +1056,28 @@ (define-public (make-libstdc++ gcc) (propagated-inputs '()) (synopsis "GNU C++ standard library"))) -(define libstdc++ - ;; Libstdc++ matching the default GCC. - (make-libstdc++ gcc)) - -(define libstdc++-headers +(define (make-libstdc++-headers gcc) ;; XXX: This package is for internal use to work around ;; (see above). The main difference compared ;; to the libstdc++ headers that come with 'gcc' is that ;; is right under include/c++ and not under ;; include/c++/x86_64-unknown-linux-gnu (aka. GPLUSPLUS_TOOL_INCLUDE_DIR). - (package - (inherit libstdc++) - (name "libstdc++-headers") - (outputs '("out")) - (build-system trivial-build-system) - (arguments - '(#:builder (let* ((out (assoc-ref %outputs "out")) - (libstdc++ (assoc-ref %build-inputs "libstdc++"))) - (mkdir out) - (mkdir (string-append out "/include")) - (symlink (string-append libstdc++ "/include") - (string-append out "/include/c++"))))) - (inputs `(("libstdc++" ,libstdc++))) - (synopsis "Headers of GNU libstdc++"))) + (let ((libstdc++ (make-libstdc++ gcc))) + (package + (inherit libstdc++) + (name "libstdc++-headers") + (outputs '("out")) + (build-system trivial-build-system) + (arguments + '(#:builder (let* ((out (assoc-ref %outputs "out")) + (libstdc++ (assoc-ref %build-inputs "libstdc++"))) + (mkdir out) + (mkdir (string-append out "/include")) + (symlink (string-append libstdc++ "/include") + (string-append out "/include/c++"))))) + (inputs `(("libstdc++" ,libstdc++))) + (synopsis "Headers of GNU libstdc++")))) (define-public libstdc++-4.9 (make-libstdc++ gcc-4.9))