GNU bug report logs -
#36346
[PATCH] gnu: Allow building toolchain with non-default libc.
Previous Next
Reported by: Carl Dong <contact <at> carldong.me>
Date: Sun, 23 Jun 2019 20:17:01 UTC
Severity: normal
Tags: fixed, patch
Done: Ludovic Courtès <ludo <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 36346 in the body.
You can then email your comments to 36346 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
guix-patches <at> gnu.org
:
bug#36346
; Package
guix-patches
.
(Sun, 23 Jun 2019 20:17:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Carl Dong <contact <at> carldong.me>
:
New bug report received and forwarded. Copy sent to
guix-patches <at> gnu.org
.
(Sun, 23 Jun 2019 20:17:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Carl Dong <accounts <at> carldong.me>
* 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))))))))
-(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))
;;; Commentary:
;;;
@@ -1014,55 +1015,59 @@ COREUTILS-FINAL vs. COREUTILS, etc."
;;; GCC toolchain.
;;;
-(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++ development to
-be installed in user profiles. This includes GCC, as well as libc (headers
-and binaries, plus debugging symbols in the @code{debug} output), and Binutils.")
- (home-page "https://gcc.gnu.org/")
- (outputs '("out" "debug" "static"))
-
- ;; The main raison d'être of this "meta-package" is (1) to conveniently
- ;; 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" ,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++ development to
+be installed in user profiles. This includes GCC, as well as libc (headers
+an d binaries, plus debugging symbols in the @code{debug} output), and Binutils.")
+ (home-page "https://gcc.gnu.org/")
+ (outputs '("out" "debug" "static"))
+
+ ;; The main raison d'être of this "meta-package" is (1) to conveniently
+ ;; 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"))))))
(define-public gcc-toolchain-4.8
(make-gcc-toolchain gcc-4.8))
--
2.22.0
Information forwarded
to
guix-patches <at> gnu.org
:
bug#36346
; Package
guix-patches
.
(Fri, 05 Jul 2019 22:48:03 GMT)
Full text and
rfc822 format available.
Message #8 received at 36346 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Carl Dong <contact <at> carldong.me> writes:
> From: Carl Dong <accounts <at> carldong.me>
>
> * 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?
[signature.asc (application/pgp-signature, inline)]
Information forwarded
to
guix-patches <at> gnu.org
:
bug#36346
; Package
guix-patches
.
(Sun, 07 Jul 2019 14:43:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 36346 <at> debbugs.gnu.org (full text, mbox):
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
> 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. :-)
Cheers,
Carl Dong
contact <at> carldong.me
"I fight for the users"
Information forwarded
to
guix-patches <at> gnu.org
:
bug#36346
; Package
guix-patches
.
(Mon, 08 Jul 2019 15:35:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 36346 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Carl Dong <contact <at> carldong.me> 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!
[signature.asc (application/pgp-signature, inline)]
Information forwarded
to
guix-patches <at> gnu.org
:
bug#36346
; Package
guix-patches
.
(Mon, 08 Jul 2019 19:43:03 GMT)
Full text and
rfc822 format available.
Message #17 received at 36346 <at> debbugs.gnu.org (full text, mbox):
From: Carl Dong <accounts <at> carldong.me>
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))))))))
-(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))
;;; Commentary:
;;;
@@ -1014,55 +1015,65 @@ COREUTILS-FINAL vs. COREUTILS, etc."
;;; GCC toolchain.
;;;
-(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++ development to
-be installed in user profiles. This includes GCC, as well as libc (headers
-and binaries, plus debugging symbols in the @code{debug} output), and Binutils.")
- (home-page "https://gcc.gnu.org/")
- (outputs '("out" "debug" "static"))
-
- ;; The main raison d'être of this "meta-package" is (1) to conveniently
- ;; 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" ,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++ development to
+be installed in user profiles. This includes GCC, as well as libc (headers
+an d binaries, plus debugging symbols in the @code{debug} output), and Binutils.")
+ (home-page "https://gcc.gnu.org/")
+ (outputs '("out" "debug" "static"))
+
+ ;; The main raison d'être of this "meta-package" is (1) to conveniently
+ ;; 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"))))))
(define-public gcc-toolchain-4.8
(make-gcc-toolchain gcc-4.8))
--
2.22.0
Added tag(s) fixed.
Request was from
Ludovic Courtès <ludo <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Fri, 19 Jul 2019 08:02:01 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
36346 <at> debbugs.gnu.org and Carl Dong <contact <at> carldong.me>
Request was from
Ludovic Courtès <ludo <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Fri, 19 Jul 2019 08:02:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 16 Aug 2019 11:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 4 years and 249 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.