From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 23 16:16:12 2019 Received: (at submit) by debbugs.gnu.org; 23 Jun 2019 20:16:12 +0000 Received: from localhost ([127.0.0.1]:54707 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hf8uJ-0001Af-Gy for submit@debbugs.gnu.org; Sun, 23 Jun 2019 16:16:12 -0400 Received: from lists.gnu.org ([209.51.188.17]:51489) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hf8uG-00018F-Tg for submit@debbugs.gnu.org; Sun, 23 Jun 2019 16:16:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48186) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hf8uF-0001iG-1V for guix-patches@gnu.org; Sun, 23 Jun 2019 16:16:08 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_50,RCVD_IN_DNSWL_LOW, URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hf8uD-0006Bq-Fw for guix-patches@gnu.org; Sun, 23 Jun 2019 16:16:06 -0400 Received: from mail2.protonmail.ch ([185.70.40.22]:29976) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hf8uC-00065v-Me for guix-patches@gnu.org; Sun, 23 Jun 2019 16:16:05 -0400 Date: Sun, 23 Jun 2019 20:15:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=carldong.me; s=protonmail; t=1561320949; bh=8umKavWMVMDzdOpOMl4Lt0FUb2RWUWV+lLAXr7UpHIQ=; h=Date:To:From:Cc:Reply-To:Subject:Feedback-ID:From; b=PtPVw6lFhmle7kAstTCLf2aD8aGOWTVjCdMpGB39FNFFeW9DTSyluS3cCc74rQqZL CeNeELxt2VHlRSBDj1VZ+3ksKyfaFJuW3gKQbZszV/nDOWwltGax8zEft7v4qJCy4x QbQlngKJwT4PjYQyrWqVXtwZoClVqEYKC8RYU6m0= To: guix-patches@gnu.org From: Carl Dong Subject: [PATCH] gnu: Allow building toolchain with non-default libc. Message-ID: Feedback-ID: a8j8tDUaJ4AYuDVBywMTwsJebN4w8TVXadJLsJb8td3t3dZi9RdXFlPaQvoFKnI9KgXySsPXcRkajVyY0cGTcA==:Ext:ProtonMail MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 185.70.40.22 X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit Cc: Carl Dong X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Carl Dong Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) From: Carl Dong * gnu/packages/base.scm (make-gcc-libc): Make public. * gnu/packages/commencement.scm (make-gcc-toolchain): Add 'libc' optional argument to specify using a non-default glibc package, also make public. --- gnu/packages/base.scm | 2 +- gnu/packages/commencement.scm | 103 ++++++++++++++++++---------------- 2 files changed, 55 insertions(+), 50 deletions(-) diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index 15f35009a9..e40b40681b 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -1009,7 +1009,7 @@ with the Linux kernel.") (("/bin/pwd") "pwd")) #t)))))))) =20 -(define (make-gcc-libc base-gcc libc) +(define-public (make-gcc-libc base-gcc libc) "Return a GCC that targets LIBC." (package (inherit base-gcc) (name (string-append (package-name base-gcc) "-" diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm index a8ec677cee..13912f1352 100644 --- a/gnu/packages/commencement.scm +++ b/gnu/packages/commencement.scm @@ -54,7 +54,8 @@ #:use-module (srfi srfi-26) #:use-module (ice-9 vlist) #:use-module (ice-9 match) - #:use-module (ice-9 regex)) + #:use-module (ice-9 regex) + #:export (make-gcc-toolchain)) =20 ;;; Commentary: ;;; @@ -1014,55 +1015,59 @@ COREUTILS-FINAL vs. COREUTILS, etc." ;;; GCC toolchain. ;;; =20 -(define (make-gcc-toolchain gcc) +(define* (make-gcc-toolchain gcc + #:optional + (libc #f)) "Return a complete toolchain for GCC." - (package - (name "gcc-toolchain") - (version (package-version gcc)) - (source #f) - (build-system trivial-build-system) - (arguments - '(#:modules ((guix build union)) - #:builder (begin - (use-modules (ice-9 match) - (srfi srfi-26) - (guix build union)) - - (let ((out (assoc-ref %outputs "out"))) - - (match %build-inputs - (((names . directories) ...) - (union-build out directories))) - - (union-build (assoc-ref %outputs "debug") - (list (assoc-ref %build-inputs - "libc-debug"))) - (union-build (assoc-ref %outputs "static") - (list (assoc-ref %build-inputs - "libc-static"))) - #t)))) - - (native-search-paths (package-native-search-paths gcc)) - (search-paths (package-search-paths gcc)) - - (license (package-license gcc)) - (synopsis "Complete GCC tool chain for C/C++ development") - (description - "This package provides a complete GCC tool chain for C/C++ developmen= t to -be installed in user profiles. This includes GCC, as well as libc (header= s -and binaries, plus debugging symbols in the @code{debug} output), and Binu= tils.") - (home-page "https://gcc.gnu.org/") - (outputs '("out" "debug" "static")) - - ;; The main raison d'=C3=AAtre of this "meta-package" is (1) to conven= iently - ;; install everything that we need, and (2) to make sure ld-wrapper co= mes - ;; before Binutils' ld in the user's profile. - (inputs `(("gcc" ,gcc) - ("ld-wrapper" ,(car (assoc-ref %final-inputs "ld-wrapper"))) - ("binutils" ,binutils-final) - ("libc" ,glibc-final) - ("libc-debug" ,glibc-final "debug") - ("libc-static" ,glibc-final "static"))))) + (let ((gcc (if libc (make-gcc-libc gcc libc) gcc)) + (libc (if libc libc gcc-final))) + (package + (name (string-append (package-name gcc) "-toolchain")) + (version (package-version gcc)) + (source #f) + (build-system trivial-build-system) + (arguments + '(#:modules ((guix build union)) + #:builder (begin + (use-modules (ice-9 match) + (srfi srfi-26) + (guix build union)) + + (let ((out (assoc-ref %outputs "out"))) + + (match %build-inputs + (((names . directories) ...) + (union-build out directories))) + + (union-build (assoc-ref %outputs "debug") + (list (assoc-ref %build-inputs + "libc-debug"))) + (union-build (assoc-ref %outputs "static") + (list (assoc-ref %build-inputs + "libc-static"))) + #t)))) + + (native-search-paths (package-native-search-paths gcc)) + (search-paths (package-search-paths gcc)) + + (license (package-license gcc)) + (synopsis "Complete GCC tool chain for C/C++ development") + (description + "This package provides a complete GCC tool chain for C/C++ developm= ent to +be installed in user profiles. This includes GCC, as well as libc (head= ers +an d binaries, plus debugging symbols in the @code{debug} output), and Bi= nutils.") + (home-page "https://gcc.gnu.org/") + (outputs '("out" "debug" "static")) + + ;; The main raison d'=C3=AAtre of this "meta-package" is (1) to conv= eniently + ;; install everything that we need, and (2) to make sure ld-wrapper = comes + ;; before Binutils' ld in the user's profile. + (inputs `(("gcc" ,gcc) + ("ld-wrapper" ,(car (assoc-ref %final-inputs "ld-wrapper")= )) + ("binutils" ,binutils-final) + ("libc" ,libc) + ("libc-debug" ,libc "debug") + ("libc-static" ,libc "static")))))) =20 (define-public gcc-toolchain-4.8 (make-gcc-toolchain gcc-4.8)) --=20 2.22.0 From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 05 18:47:07 2019 Received: (at 36346) by debbugs.gnu.org; 5 Jul 2019 22:47:08 +0000 Received: from localhost ([127.0.0.1]:53929 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hjWyx-0005vB-Ij for submit@debbugs.gnu.org; Fri, 05 Jul 2019 18:47:07 -0400 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:52679) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hjWyu-0005uf-5J for 36346@debbugs.gnu.org; Fri, 05 Jul 2019 18:47:05 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id B9A7521111; Fri, 5 Jul 2019 18:46:58 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Fri, 05 Jul 2019 18:46:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h= from:to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; s=fm3; bh=gdnlIDjcvi1a5LYc0yF892aeFs cVNzufzRrIVX/gQgM=; b=StC7xg6yM6bRz6YiUG+qxq3ORNFeiYd1z78Nnly2uu EnGj/T7uFfVaCav6m+hOLVKQkQqIQgpv0wcxxKcSkunyqVYp9GfFjWpOQRdcCave lCiuPwXzhZMJr8YJpvWVHzxEADQar8/86s7yQgHNF842XaMKmCUs0h1N6o8v2IaB g45VOizM8rlKTSjGNpRdnEUErGMCmgxUoYspnDj+NpJqjxLGPZkN4Qpj5xH4kUkp odefihHuBgInYIJQUJWCyPRhu3pe13Ir7CAwCSbvW0fAx6orkwBb+vhs8HkJz2Qr OL5EI0cRGAAYWkoo1E3yaUQet/7ZfA3SLdpAwsXDnjUw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=gdnlID jcvi1a5LYc0yF892aeFscVNzufzRrIVX/gQgM=; b=quDhUWN9qlykkfJghh7qLh Z6HUCnIE71Bez/8qvkvEDwf7TZUzXC4RLjH33urFlkPTrTHbwxhuuiRrTJHWZwpn 0vfrgd7XBDTwe03zP+3qy29g+xaTV7Vg7TjY/ZzT5FJtQ5dAkyzAFLGzBH7JMzz4 epujAgqyOA0K36NPhQMYc5fJcR9Gz9ZmUblQEa6lcnIX6w11WwEdH8Y0ovdB/fNs 2/VkcVEa/WnohBgM0TF0xRXfP/FwCbUQiZgILs/8N5n1DzKhNWXvyJFMNm8I/1DJ iYmlBN/dyqnRBN3KDeskjQCTgQmh1Joc2UACFbfm+8mMjPtcSqjl+r7FzV9UDXoQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrfeehgddufecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufgjfhgffffkgggtsehgtderre dtredtnecuhfhrohhmpeforghrihhushcuuegrkhhkvgcuoehmsggrkhhkvgesfhgrshht mhgrihhlrdgtohhmqeenucfkphepiedvrdduiedrvddviedrudegtdenucfrrghrrghmpe hmrghilhhfrhhomhepmhgsrghkkhgvsehfrghsthhmrghilhdrtghomhenucevlhhushht vghrufhiiigvpedt X-ME-Proxy: Received: from localhost (140.226.16.62.customer.cdi.no [62.16.226.140]) by mail.messagingengine.com (Postfix) with ESMTPA id 0F4D080061; Fri, 5 Jul 2019 18:46:57 -0400 (EDT) From: Marius Bakke To: Carl Dong , 36346@debbugs.gnu.org Subject: Re: [bug#36346] [PATCH] gnu: Allow building toolchain with non-default libc. In-Reply-To: References: User-Agent: Notmuch/0.29.1 (https://notmuchmail.org) Emacs/26.2 (x86_64-pc-linux-gnu) Date: Sat, 06 Jul 2019 00:46:56 +0200 Message-ID: <87y31cqeu7.fsf@devup.no> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 36346 Cc: Carl Dong X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-=-= Content-Type: text/plain Carl Dong writes: > From: Carl Dong > > * gnu/packages/base.scm (make-gcc-libc): Make public. > * gnu/packages/commencement.scm (make-gcc-toolchain): Add 'libc' > optional argument to specify using a non-default glibc package, also > make public. It would be easier to digest this patch if it came with an actual user of this change. Right now it complicates a very simple procedure for no apparent reason. Can you elaborate a bit on the use case? Guix excels at creating bespoke toolchains like these. It is easy to express this change as a new 'make-gcc-toolchain-with-custom-libc' procedure. So I'm not sure if it's worth changing 'make-gcc-toolchain', which serves a fairly specific use case. I would expect any reasonably complex toolchain to need further tweaks, and we cannot possibly support all such configuration inside 'make-gcc-toolchain'. Does that make sense? It does sound useful to make these procedures more generally accessible however. Perhaps 'make-gcc-toolchain' could be implemented in terms of a more generic 'make-toolchain' interface? --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAl0f02AACgkQoqBt8qM6 VPpLQggA1RBXndQ0HJCeUdSwO03moa691jd6USDQLUmZ4XRHEPKa8MF+q4C+7sef RegOezahQ2aIht5ze/Is13N4VFC+sK4jLtP3KjGab9HKwANKuNKMJy5GXAXDa7mJ aHsz+eME2LsZoJ0r6ZRmKEpqUpW7ypUNjEk/MeqErij6r9OB/u8z6OZs9gguE4rs yApllbnirW5HU6jYWJRBnJHu0A8ANWr/EJdsKLwyJHOFYZPfe+qpHoowDZqkVFkh K3cgLMQIkq0pMbjVVkL3yeucvmNqr8lAECO+jozBfFeKCaTODCrkEF+qW8SsVi0x aDlPRbXzRzvbf2QzehxLGMmq5YjNdQ== =rCq1 -----END PGP SIGNATURE----- --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 07 10:42:39 2019 Received: (at 36346) by debbugs.gnu.org; 7 Jul 2019 14:42:39 +0000 Received: from localhost ([127.0.0.1]:57295 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hk8NC-0000Ed-M9 for submit@debbugs.gnu.org; Sun, 07 Jul 2019 10:42:38 -0400 Received: from mail2.protonmail.ch ([185.70.40.22]:33787) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hk8NA-0000EM-C4 for 36346@debbugs.gnu.org; Sun, 07 Jul 2019 10:42:37 -0400 Date: Sun, 07 Jul 2019 14:42:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=carldong.me; s=protonmail; t=1562510549; bh=K3y9R/3umEqbD2+Fp0tJznxyp2kmONIl00azOloax34=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References: Feedback-ID:From; b=kSgwFEZIqwlg7/g5GkKNqBvbzv0kLLf4yXiVoYRupKVcPntTzMSKeXSC5QcJjg3Dr hoOQlOG2cDRK4Xx6tlCCU+BHTqf43FhxS5NNlM07ZsG/qTm7HclbfEqKGn0+BrYp6B F4Y6E9BJnsmKmJ0/CLn/HHxuIxCmYfv5U34Y1d4o= To: Marius Bakke From: Carl Dong Subject: Re: [bug#36346] [PATCH] gnu: Allow building toolchain with non-default libc. Message-ID: In-Reply-To: <87y31cqeu7.fsf@devup.no> References: <87y31cqeu7.fsf@devup.no> Feedback-ID: a8j8tDUaJ4AYuDVBywMTwsJebN4w8TVXadJLsJb8td3t3dZi9RdXFlPaQvoFKnI9KgXySsPXcRkajVyY0cGTcA==:Ext:ProtonMail MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=7.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.protonmail.ch X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 36346 Cc: "36346@debbugs.gnu.org" <36346@debbugs.gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Carl Dong Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi Marius! > It would be easier to digest this patch if it came with an actual user of= this > change. Right now it complicates a very simple procedure for no apparent > reason. Can you elaborate a bit on the use case? Ah! This change is motivated by the work I've been doing in shifting the Bi= tcoin release process to a Guix-based one. The binaries we produce aim to be compatible with GLIBC_2_11, and we have glibc compat wrappers (https://github.com/bitcoin/bitcoin/blob/f373beebbcc0c7d1160e02dc638a00b3e6= 831d98/src/compat/glibc_compat.cpp) all the way up to 2.27 (since we need RISCV support). With Guix, I hope tha= t we don't have to keep updating compat wrappers anymore, and pin our toolchain = glibc version to a fixed one. See here for how I use this: https://github.com/bitcoin/bitcoin/blob/e8dd4da0b287e0fe252c99bb4a7cb26c2e9= 47b71/contrib/guix/packages/gcc-bitcoin.scm#L91 > Guix excels at creating bespoke toolchains like these. It is easy to expr= ess > this change as a new 'make-gcc-toolchain-with-custom-libc' procedure. So = I'm > not sure if it's worth changing 'make-gcc-toolchain', which serves a fair= ly > specific use case. > > I would expect any reasonably complex toolchain to need further tweaks, a= nd we > cannot possibly support all such configuration inside 'make-gcc-toolchain= '. > > It does sound useful to make these procedures more generally accessible > however. Perhaps 'make-gcc-toolchain' could be implemented in terms of a = more > generic 'make-toolchain' interface? That all sound like promising solutions. My thought process comes from port= ing riscv64 to Guix, where I realized that I had to override the default gcc ve= rsion (riscv64 requires gcc 7.1), glibc version (2.27), and kernel headers versio= n (4.15). That makes me think that the sensible list of things to be overrida= ble for a toolchain would be those three, in case of future architectures. I've submitted previous patches to cross-base.scm that added the ability to parameterize these three, and this patch was simply doing the same for gcc-toolchain. Anyway, please let me know which approach you'd prefer, and I'd be very hap= py to implement and change. :-) Cheers, Carl Dong contact@carldong.me "I fight for the users" From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 08 11:34:36 2019 Received: (at 36346) by debbugs.gnu.org; 8 Jul 2019 15:34:36 +0000 Received: from localhost ([127.0.0.1]:59337 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hkVf2-00014a-2R for submit@debbugs.gnu.org; Mon, 08 Jul 2019 11:34:36 -0400 Received: from new1-smtp.messagingengine.com ([66.111.4.221]:45927) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hkVez-00014H-Ud for 36346@debbugs.gnu.org; Mon, 08 Jul 2019 11:34:34 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id AC8B93101; Mon, 8 Jul 2019 11:34:28 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 08 Jul 2019 11:34:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h= from:to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; s=fm3; bh=6+GNFNbIFy3QjyBHpA7Hc+Pc9P y+k2Rm2vbfnQPe4R4=; b=ATB12yzbteDOZ+/TK03na2zvr6MSYbXaMK3JvJCgQN vEh0D/vbqp0W9mdMfiTJ6yr4jOJOyusAaNmCf1q2wpy42pEGEVDVDF66oAMOcR0s Att46QmPc2aT44zG+vBZWfSwswwcfKfW2zXht783JzEGoBRxuEq8Qjp2FNvQ/NvG Fv+UE55aRSeW237+nwwpSUr/QQXzn6RA4EpKOMNtvScYUqGegYiw0mMZKhjx3ESw /Us2kHi+xEEZU0ezdxCeU2INTm29cBUlRM/xbMKAiefvahPt1qT85R7T1Ptf8M2o xtKJQ3pJZpb7rtwK80GeZd85IjkWcBH8cRh6Q2+iOw6w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=6+GNFN bIFy3QjyBHpA7Hc+Pc9Py+k2Rm2vbfnQPe4R4=; b=px+XUOJe95kVL5zC3Ros7/ nO1ga77t21w1/uwQyzmW1+d1MbboGMlD5TYf1mR9QiJ7/YBARCLS0y7JAJIFhM/w 9vGxfXnHWJ8+ExD7P6tCAd7JjqnIGSroz1fWMFsB5ygBTqsU0TMjDR0vSwE1PX9K MKmpeJpPpepg9BBz8vXw8TCEwVOND11QpqtThHw6WN/lBMLIgaM5sVNnx5bjhEN8 7pq7IIRT88ClnIuNCl1T6h+oO0YbfF272g3mXtWVyhsl7jMMGmcw5/iMXLCGWr68 XBDu81qQBnSHyiGIUGxCAW6NjTkl8dYiP1o3j9VDetuf5fc57uLPTAyWs7ZFmyTg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrgedtgdelgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecuogfggedtledqgedtucdlfedttddmnecujfgurhephf fvufgjfhgffffkgggtsehgtderredtredtnecuhfhrohhmpeforghrihhushcuuegrkhhk vgcuoehmsggrkhhkvgesfhgrshhtmhgrihhlrdgtohhmqeenucffohhmrghinhepghhith hhuhgsrdgtohhmnecukfhppeeivddrudeirddvvdeirddugedtnecurfgrrhgrmhepmhgr ihhlfhhrohhmpehmsggrkhhkvgesfhgrshhtmhgrihhlrdgtohhmnecuvehluhhsthgvrh fuihiivgeptd X-ME-Proxy: Received: from localhost (140.226.16.62.customer.cdi.no [62.16.226.140]) by mail.messagingengine.com (Postfix) with ESMTPA id 2F0E480063; Mon, 8 Jul 2019 11:34:28 -0400 (EDT) From: Marius Bakke To: Carl Dong Subject: Re: [bug#36346] [PATCH] gnu: Allow building toolchain with non-default libc. In-Reply-To: References: <87y31cqeu7.fsf@devup.no> User-Agent: Notmuch/0.29.1 (https://notmuchmail.org) Emacs/26.2 (x86_64-pc-linux-gnu) Date: Mon, 08 Jul 2019 17:34:20 +0200 Message-ID: <8736jgr14z.fsf@devup.no> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 36346 Cc: "36346@debbugs.gnu.org" <36346@debbugs.gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-=-= Content-Type: text/plain Carl Dong writes: > Hi Marius! > >> It would be easier to digest this patch if it came with an actual user of this >> change. Right now it complicates a very simple procedure for no apparent >> reason. Can you elaborate a bit on the use case? > > Ah! This change is motivated by the work I've been doing in shifting the Bitcoin > release process to a Guix-based one. The binaries we produce aim to be > compatible with GLIBC_2_11, and we have glibc compat wrappers > (https://github.com/bitcoin/bitcoin/blob/f373beebbcc0c7d1160e02dc638a00b3e6831d98/src/compat/glibc_compat.cpp) > all the way up to 2.27 (since we need RISCV support). With Guix, I hope that we > don't have to keep updating compat wrappers anymore, and pin our toolchain glibc > version to a fixed one. See here for how I use this: > https://github.com/bitcoin/bitcoin/blob/e8dd4da0b287e0fe252c99bb4a7cb26c2e947b71/contrib/guix/packages/gcc-bitcoin.scm#L91 I see, thanks for the links. >> Guix excels at creating bespoke toolchains like these. It is easy to express >> this change as a new 'make-gcc-toolchain-with-custom-libc' procedure. So I'm >> not sure if it's worth changing 'make-gcc-toolchain', which serves a fairly >> specific use case. >> >> I would expect any reasonably complex toolchain to need further tweaks, and we >> cannot possibly support all such configuration inside 'make-gcc-toolchain'. >> >> It does sound useful to make these procedures more generally accessible >> however. Perhaps 'make-gcc-toolchain' could be implemented in terms of a more >> generic 'make-toolchain' interface? > > That all sound like promising solutions. My thought process comes from porting > riscv64 to Guix, where I realized that I had to override the default gcc version > (riscv64 requires gcc 7.1), glibc version (2.27), and kernel headers version > (4.15). That makes me think that the sensible list of things to be overridable > for a toolchain would be those three, in case of future architectures. I've > submitted previous patches to cross-base.scm that added the ability to > parameterize these three, and this patch was simply doing the same for > gcc-toolchain. > > Anyway, please let me know which approach you'd prefer, and I'd be very happy to > implement and change. :-) I feel better about this patch now that I've seen its uses. It would be great if you could leave some comments at the top of the definition about what the libc argument is for, and maybe even a usage example. Otherwise it LGTM. Let's hold it for a couple of days in case others have additional suggestions. Thanks! --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAl0jYnwACgkQoqBt8qM6 VPqacQf/R/rjukMVyy+c8rpuxOPLBd4cGsg1AC8xSx1FspI2VFk3l2UjoX4s5ywC N9C0DZ4B0bAY1lWD8aYX+ZD4/TbsaxbPQwTUdE9R9WJe8JgQ0/WhWM5JZhjUuHX/ HzkTl89HnKncYKl1LzLhAxGpqPvu9JuOA680comO8JcwJImk9BvPJP6fnJNvJK35 ETrruwvlWyHCW1GAOXzDBu1Uxbac0IxFWD8dI26wdFQENeluZxAp/ZrKk4b3e5M8 OYvpEvHNi5Q9hpv+yCy4T11uBWgsFHiSbIjiBqA4viEHR0C17JsxEJjyTft+bIcd MYGKy2mjIwIm/VzHEAwSGz0bIKVgNw== =frjb -----END PGP SIGNATURE----- --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 08 15:42:15 2019 Received: (at 36346) by debbugs.gnu.org; 8 Jul 2019 19:42:15 +0000 Received: from localhost ([127.0.0.1]:59587 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hkZWh-0003lY-1X for submit@debbugs.gnu.org; Mon, 08 Jul 2019 15:42:15 -0400 Received: from mail1.protonmail.ch ([185.70.40.18]:18340) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hkZWd-0003l3-OG for 36346@debbugs.gnu.org; Mon, 08 Jul 2019 15:42:12 -0400 Date: Mon, 08 Jul 2019 19:41:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=carldong.me; s=protonmail; t=1562614923; bh=tuC6gGjExdCns2JKcV+QAmvR3rBQK4FNEmyTxXv/NZA=; h=Date:To:From:Cc:Reply-To:Subject:Feedback-ID:From; b=dyzSaSZtkjm9rLwc9X63/g/H+UzNIkp0YXC8KVXltGLaXZLX7DFoEpMiO+QxLwgj6 vikfYQMdNM24dPAjTr9DXs4CItwN4paA4bAzAVJWPN7bA8gyQ2nNM5qA9NX9+iJfjK lcZO4kCxApjl0gDifJqd8xbpy59K3QASZnBfLt9c= To: 36346@debbugs.gnu.org From: Carl Dong Subject: [PATCH] gnu: Allow building toolchain with non-default libc. Message-ID: <4_kqCtHTlX-MONOFQC9zlsdzOvhHCH5UOLZF_9b2nJIdAA_kZltvFZRcpFNOX-Oj8UL7loc9DY13SOGeUsfpKiLj5wDGftA96g3-661mIG8=@carldong.me> Feedback-ID: a8j8tDUaJ4AYuDVBywMTwsJebN4w8TVXadJLsJb8td3t3dZi9RdXFlPaQvoFKnI9KgXySsPXcRkajVyY0cGTcA==:Ext:ProtonMail MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=7.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.protonmail.ch X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 36346 Cc: Carl Dong X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Carl Dong Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) From: Carl Dong Here's the updated patch, with the clarifications requested. * gnu/packages/base.scm (make-gcc-libc): Make public. * gnu/packages/commencement.scm (make-gcc-toolchain): Add 'libc' optional argument to specify using a non-default glibc package, also make public. --- gnu/packages/base.scm | 2 +- gnu/packages/commencement.scm | 111 +++++++++++++++++++--------------- 2 files changed, 62 insertions(+), 51 deletions(-) diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index 15f35009a9..e40b40681b 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -1009,7 +1009,7 @@ with the Linux kernel.") (("/bin/pwd") "pwd")) #t)))))))) =20 -(define (make-gcc-libc base-gcc libc) +(define-public (make-gcc-libc base-gcc libc) "Return a GCC that targets LIBC." (package (inherit base-gcc) (name (string-append (package-name base-gcc) "-" diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm index a8ec677cee..4a41e2abf3 100644 --- a/gnu/packages/commencement.scm +++ b/gnu/packages/commencement.scm @@ -54,7 +54,8 @@ #:use-module (srfi srfi-26) #:use-module (ice-9 vlist) #:use-module (ice-9 match) - #:use-module (ice-9 regex)) + #:use-module (ice-9 regex) + #:export (make-gcc-toolchain)) =20 ;;; Commentary: ;;; @@ -1014,55 +1015,65 @@ COREUTILS-FINAL vs. COREUTILS, etc." ;;; GCC toolchain. ;;; =20 -(define (make-gcc-toolchain gcc) - "Return a complete toolchain for GCC." - (package - (name "gcc-toolchain") - (version (package-version gcc)) - (source #f) - (build-system trivial-build-system) - (arguments - '(#:modules ((guix build union)) - #:builder (begin - (use-modules (ice-9 match) - (srfi srfi-26) - (guix build union)) - - (let ((out (assoc-ref %outputs "out"))) - - (match %build-inputs - (((names . directories) ...) - (union-build out directories))) - - (union-build (assoc-ref %outputs "debug") - (list (assoc-ref %build-inputs - "libc-debug"))) - (union-build (assoc-ref %outputs "static") - (list (assoc-ref %build-inputs - "libc-static"))) - #t)))) - - (native-search-paths (package-native-search-paths gcc)) - (search-paths (package-search-paths gcc)) - - (license (package-license gcc)) - (synopsis "Complete GCC tool chain for C/C++ development") - (description - "This package provides a complete GCC tool chain for C/C++ developmen= t to -be installed in user profiles. This includes GCC, as well as libc (header= s -and binaries, plus debugging symbols in the @code{debug} output), and Binu= tils.") - (home-page "https://gcc.gnu.org/") - (outputs '("out" "debug" "static")) - - ;; The main raison d'=C3=AAtre of this "meta-package" is (1) to conven= iently - ;; install everything that we need, and (2) to make sure ld-wrapper co= mes - ;; before Binutils' ld in the user's profile. - (inputs `(("gcc" ,gcc) - ("ld-wrapper" ,(car (assoc-ref %final-inputs "ld-wrapper"))) - ("binutils" ,binutils-final) - ("libc" ,glibc-final) - ("libc-debug" ,glibc-final "debug") - ("libc-static" ,glibc-final "static"))))) +;; Using the following procedure, a gcc toolchain targeting glibc-2.27 can= be +;; instantiated like this: +;; +;; (define-public gcc-glibc-2.27-toolchain +;; (make-gcc-toolchain gcc glibc-2.27)) + +(define* (make-gcc-toolchain gcc + #:optional + (libc #f)) + "Return a complete toolchain for GCC. If LIBC is specified, target that = libc." + (let ((gcc (if libc (make-gcc-libc gcc libc) gcc)) + (libc (if libc libc glibc-final))) + (package + (name (string-append (package-name gcc) "-toolchain")) + (version (package-version gcc)) + (source #f) + (build-system trivial-build-system) + (arguments + '(#:modules ((guix build union)) + #:builder (begin + (use-modules (ice-9 match) + (srfi srfi-26) + (guix build union)) + + (let ((out (assoc-ref %outputs "out"))) + + (match %build-inputs + (((names . directories) ...) + (union-build out directories))) + + (union-build (assoc-ref %outputs "debug") + (list (assoc-ref %build-inputs + "libc-debug"))) + (union-build (assoc-ref %outputs "static") + (list (assoc-ref %build-inputs + "libc-static"))) + #t)))) + + (native-search-paths (package-native-search-paths gcc)) + (search-paths (package-search-paths gcc)) + + (license (package-license gcc)) + (synopsis "Complete GCC tool chain for C/C++ development") + (description + "This package provides a complete GCC tool chain for C/C++ developm= ent to +be installed in user profiles. This includes GCC, as well as libc (head= ers +an d binaries, plus debugging symbols in the @code{debug} output), and Bi= nutils.") + (home-page "https://gcc.gnu.org/") + (outputs '("out" "debug" "static")) + + ;; The main raison d'=C3=AAtre of this "meta-package" is (1) to conv= eniently + ;; install everything that we need, and (2) to make sure ld-wrapper = comes + ;; before Binutils' ld in the user's profile. + (inputs `(("gcc" ,gcc) + ("ld-wrapper" ,(car (assoc-ref %final-inputs "ld-wrapper")= )) + ("binutils" ,binutils-final) + ("libc" ,libc) + ("libc-debug" ,libc "debug") + ("libc-static" ,libc "static")))))) =20 (define-public gcc-toolchain-4.8 (make-gcc-toolchain gcc-4.8)) --=20 2.22.0 From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 19 04:01:16 2019 Received: (at control) by debbugs.gnu.org; 19 Jul 2019 08:01:16 +0000 Received: from localhost ([127.0.0.1]:55067 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hoNpM-0002JX-9C for submit@debbugs.gnu.org; Fri, 19 Jul 2019 04:01:16 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:48518) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hoNpJ-0002JH-O6 for control@debbugs.gnu.org; Fri, 19 Jul 2019 04:01:14 -0400 X-IronPort-AV: E=Sophos;i="5.64,281,1559512800"; d="scan'208";a="392460524" Received: from unknown (HELO ribbon) ([193.50.110.82]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/AES256-GCM-SHA384; 19 Jul 2019 10:01:07 +0200 Date: Fri, 19 Jul 2019 10:01:07 +0200 Message-Id: <87o91qe9mk.fsf@gnu.org> To: control@debbugs.gnu.org From: =?utf-8?Q?Ludovic_Court=C3=A8s?= Subject: control message for bug #36346 MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) tags 36346 fixed close 36346 quit From unknown Tue Jun 24 06:58:01 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 16 Aug 2019 11:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator