[PATCH 0/2] Fix libstdc++.so and gcc-toolchain

  • Open
  • quality assurance status badge
Details
4 participants
  • John Kehayias
  • Kaelyn
  • Ludovic Courtès
  • Simon Tournier
Owner
unassigned
Submitted by
Simon Tournier
Severity
normal
S
S
Simon Tournier wrote on 9 May 18:58 +0200
(address . guix-patches@gnu.org)(name . Simon Tournier)(address . zimon.toutoune@gmail.com)
cover.1683650835.git.zimon.toutoune@gmail.com
Hi,

This patch fixes #63267 [1] by adding the output 'lib' to gcc-toolchain. The
aim of gcc-toolchain is to be a battery included of GCC. Maybe, this 'lib'
output could be directly included with the 'out'. Well, I do not know. WDYT?

For sure, it seems to help people using 'gcc:lib'. :-)

Toggle snippet (26 lines)
$ ./pre-inst-env guix shell gcc-toolchain:lib

[...]

$ ls $GUIX_ENVIRONMENT/lib
audit libatomic.a libc.so.6 libitm.so.1.0.0 libnss_files.so.2 libssp_nonshared.a libtsan_preinit.o
bfd-plugins libatomic.la libctf.a libitm.spec libnss_hesiod.so libssp_nonshared.la libtsan.so
crt1.o libatomic.so libctf.la liblsan.a libnss_hesiod.so.2 libssp.so libtsan.so.2
crti.o libatomic.so.1 libctf-nobfd.a liblsan.la libopcodes.a libssp.so.0 libtsan.so.2.0.0
crtn.o libatomic.so.1.2.0 libctf-nobfd.la liblsan_preinit.o libopcodes.la libssp.so.0.0.0 libubsan.a
gcc libbfd.a libdl.a liblsan.so libpcprofile.so libstdc++.a libubsan.la
gconv libbfd.la libdl.so.2 liblsan.so.0 libpthread.a libstdc++fs.a libubsan.so
gcrt1.o libBrokenLocale.so libgcc_s.so liblsan.so.0.0.0 libpthread.so.0 libstdc++fs.la libubsan.so.1
grcrt1.o libBrokenLocale.so.1 libgcc_s.so.1 libmemusage.so libquadmath.a libstdc++.la libubsan.so.1.0.0
ld-linux-x86-64.so.2 libcc1.la libgomp.a libm.so libquadmath.la libstdc++.so libutil.a
libanl.a libcc1.so libgomp.la libm.so.6 libquadmath.so libstdc++.so.6 libutil.so.1
libanl.so libcc1.so.0 libgomp.so libmvec.so libquadmath.so.0 libstdc++.so.6.0.30 Mcrt1.o
libanl.so.1 libcc1.so.0.0.0 libgomp.so.1 libmvec.so.1 libquadmath.so.0.0.0 libstdc++.so.6.0.30-gdb.py rcrt1.o
libasan.a libc_malloc_debug.so libgomp.so.1.0.0 libnsl.so.1 libresolv.so libsupc++.a Scrt1.o
libasan.la libc_malloc_debug.so.0 libgomp.spec libnss_compat.so libresolv.so.2 libsupc++.la
libasan_preinit.o libc_nonshared.a libitm.a libnss_compat.so.2 librt.so.1 libthread_db.so
libasan.so libcrypt.so libitm.la libnss_db.so libsanitizer.spec libthread_db.so.1
libasan.so.8 libcrypt.so.1 libitm.so libnss_db.so.2 libssp.a libtsan.a
libasan.so.8.0.0 libc.so libitm.so.1 libnss_dns.so.2 libssp.la libtsan.la

Well, another annoyance is that libstdc++ could be built using another
version. Let for later. :-)



Cheers,
simon


Simon Tournier (2):
gnu: gcc-toolchain: Do not use gcc-final.
gnu: make-gcc-toolchain: Add 'lib' outputs.

gnu/packages/commencement.scm | 35 +++++++++++++++++++++++++++--------
1 file changed, 27 insertions(+), 8 deletions(-)


base-commit: 76a3deb8675576a6ce64874234c9d3881060db3b
--
2.38.1
S
S
Simon Tournier wrote on 9 May 19:04 +0200
[PATCH 1/2] gnu: gcc-toolchain: Do not use gcc-final.
(address . 63393@debbugs.gnu.org)(name . Simon Tournier)(address . zimon.toutoune@gmail.com)
27f75012219400a41da9c3148ec42fd4cec38cc4.1683650835.git.zimon.toutoune@gmail.com
* gnu/packages/commencement.scm (gcc-toolchain): Bind to the default
gcc-toolchain-11 being consitent with others.
(gcc-toolchain-11): Make it from gcc-11.
(gcc-toolchain-aka-gcc): Bind to gcc-toolchain.
---
gnu/packages/commencement.scm | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

Toggle diff (37 lines)
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index ab07fb37ab..7ec177e206 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -3486,8 +3486,6 @@ (define* (make-gcc-toolchain gcc
("libc-debug" ,libc "debug")
("libc-static" ,libc "static"))))))
-(define-public gcc-toolchain
- (make-gcc-toolchain gcc-final))
(define-public gcc-toolchain-4.8
(make-gcc-toolchain gcc-4.8))
@@ -3514,15 +3512,19 @@ (define-public gcc-toolchain-10
(make-gcc-toolchain gcc-10))
(define-public gcc-toolchain-11
- gcc-toolchain)
+ (make-gcc-toolchain gcc-11))
(define-public gcc-toolchain-12
(make-gcc-toolchain gcc-12))
+;; The default GCC
+(define-public gcc-toolchain
+ gcc-toolchain-11)
+
(define-public gcc-toolchain-aka-gcc
;; It's natural for users to try "guix install gcc". This package
;; automatically "redirects" them to 'gcc-toolchain'.
- (deprecated-package "gcc" gcc-toolchain-11))
+ (deprecated-package "gcc" gcc-toolchain))
(define-public gdc-toolchain-10
--
2.38.1
S
S
Simon Tournier wrote on 9 May 19:04 +0200
[PATCH 2/2] gnu: make-gcc-toolchain: Add 'lib' outputs.
(address . 63393@debbugs.gnu.org)(name . Simon Tournier)(address . zimon.toutoune@gmail.com)
ce970fb1a1f436542b5602013369654c63f100f4.1683650835.git.zimon.toutoune@gmail.com
* gnu/packages/commencement.scm (make-gcc-toolchain): Add 'lib' outputs.
---
gnu/packages/commencement.scm | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)

Toggle diff (67 lines)
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index 7ec177e206..94d5884a9c 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -14,6 +14,7 @@
;;; Copyright © 2021 Julien Lepiller <julien@lepiller.eu>
;;; Copyright © 2022 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2022 Ekaitz Zarraga <ekaitz@elenq.tech>
+;;; Copyright © 2023 Simon Tournier <zimon.toutoune@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -3444,15 +3445,30 @@ (define* (make-gcc-toolchain gcc
(filter-map (match-lambda
(("libc-debug" . _) #f)
(("libc-static" . _) #f)
+ (("gcc-lib" . _) #f)
+ (("gcc-debug" . _) #f)
((_ . directory) directory))
%build-inputs))
(union-build (assoc-ref %outputs "debug")
(list (assoc-ref %build-inputs
- "libc-debug")))
+ "libc-debug")
+ (assoc-ref %build-inputs
+ "gcc-debug")))
+
(union-build (assoc-ref %outputs "static")
(list (assoc-ref %build-inputs
"libc-static")))
+
+ (union-build (assoc-ref %outputs "lib")
+ (list (assoc-ref %build-inputs
+ "ld-wrapper")
+ (assoc-ref %build-inputs
+ "binutils")
+ (assoc-ref %build-inputs
+ "gcc-lib")
+ (assoc-ref %build-inputs
+ "libc")))
#t))))
(native-search-paths
@@ -3474,7 +3490,7 @@ (define* (make-gcc-toolchain gcc
binaries, plus debugging symbols in the @code{debug} output), and Binutils. GCC
is the GNU Compiler Collection.")
(home-page "https://gcc.gnu.org/")
- (outputs '("out" "debug" "static"))
+ (outputs '("out" "debug" "static" "lib"))
;; 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
@@ -3484,8 +3500,9 @@ (define* (make-gcc-toolchain gcc
("binutils" ,binutils-final)
("libc" ,libc)
("libc-debug" ,libc "debug")
- ("libc-static" ,libc "static"))))))
-
+ ("libc-static" ,libc "static")
+ ("gcc-lib" ,gcc "lib")
+ ("gcc-debug" ,gcc "debug"))))))
(define-public gcc-toolchain-4.8
(make-gcc-toolchain gcc-4.8))
--
2.38.1
K
K
Kaelyn wrote on 9 May 20:50 +0200
[PATCH 0/2] Fix libstdc++.so and gcc-toolchain
(name . 63393@debbugs.gnu.org)(address . 63393@debbugs.gnu.org)
nJpIaVpIYRxrmpaCLRWX4_Wiv4hasCHFZH5A-HQQUb4wJ6xAUJ1K-yxWt1ApIvVPnvPtAeoYQrYoC945qyOvEibk0dseBeGPJUiZC2c9ibo=@protonmail.com
Hi,

I like the direction of this patch. However, if gcc-toolchain:lib is intended to provide the runtime libraries when the full compiler isn't needed, then I think the .a and .la files should be moved back to the main gcc-toolchain output (or a separate :static output) since they are for static linking and the .a files in particular can be sizeable.

Cheers,
Kaelyn
L
L
Ludovic Courtès wrote on 11 May 15:38 +0200
(name . Simon Tournier)(address . zimon.toutoune@gmail.com)
87r0rn2dl2.fsf_-_@gnu.org
Hi,

Simon Tournier <zimon.toutoune@gmail.com> skribis:

Toggle quote (2 lines)
> * gnu/packages/commencement.scm (make-gcc-toolchain): Add 'lib' outputs.

[...]

Toggle quote (6 lines)
> (filter-map (match-lambda
> (("libc-debug" . _) #f)
> (("libc-static" . _) #f)
> + (("gcc-lib" . _) #f)
> + (("gcc-debug" . _) #f)

I would include gcc:lib in “out” (thus not adding a “lib” output to
‘gcc-toolchain’).

Yes, gcc:lib includes *.a and *.la, but those are already part of the
‘gcc-toolchain’ closure:

Toggle snippet (9 lines)
$ guix size gcc-toolchain |head -6
store item total self
/gnu/store/jv78mm3dmr6fl2hhy1bkbhfpm702v3gq-gcc-12.3.0 292.6 169.4 41.2%
/gnu/store/zh4x65snfis7svs6906gj1z8i7dx2j3m-binutils-2.38 95.5 54.9 13.4%
/gnu/store/g8p09w6r78hhkl2rv1747pcp9zbk6fxv-guile-3.0.9 134.0 53.1 12.9%
/gnu/store/gsjczqir1wbz8p770zndrpw4rnppmxi3-glibc-2.35 40.6 38.8 9.4%
/gnu/store/gmv6n5vy5qcsn71pkapg2hnknyn1p7g3-gcc-12.3.0-lib 76.8 36.2 8.8%

However, I’d leave out gcc:debug because (0) it’s unrelated :-), (1)
‘gcc-final’ has no “debug” output, and (2) it’s really for a niche
(folks developing compiler plugins, typically).

I’d also leave out the /lib directory of Binutils, which is again rarely
useful.

WDYT?

Thanks,
Ludo’.
J
J
John Kehayias wrote on 16 Jul 20:33 +0200
(address . 63393@debbugs.gnu.org)
87sf9nzoxf.fsf_-_@protonmail.com
Hello,

On Thu, May 11, 2023 at 03:38 PM, Ludovic Courtès wrote:

Toggle quote (38 lines)
> Hi,
>
> Simon Tournier <zimon.toutoune@gmail.com> skribis:
>
>> * gnu/packages/commencement.scm (make-gcc-toolchain): Add 'lib' outputs.
>
> [...]
>
>> (filter-map (match-lambda
>> (("libc-debug" . _) #f)
>> (("libc-static" . _) #f)
>> + (("gcc-lib" . _) #f)
>> + (("gcc-debug" . _) #f)
>
> I would include gcc:lib in “out” (thus not adding a “lib” output to
> ‘gcc-toolchain’).
>
> Yes, gcc:lib includes *.a and *.la, but those are already part of the
> ‘gcc-toolchain’ closure:
>
> $ guix size gcc-toolchain |head -6
> store item total self
> /gnu/store/jv78mm3dmr6fl2hhy1bkbhfpm702v3gq-gcc-12.3.0 292.6 169.4 41.2%
> /gnu/store/zh4x65snfis7svs6906gj1z8i7dx2j3m-binutils-2.38 95.5 54.9 13.4%
> /gnu/store/g8p09w6r78hhkl2rv1747pcp9zbk6fxv-guile-3.0.9 134.0 53.1 12.9%
> /gnu/store/gsjczqir1wbz8p770zndrpw4rnppmxi3-glibc-2.35 40.6 38.8 9.4%
> /gnu/store/gmv6n5vy5qcsn71pkapg2hnknyn1p7g3-gcc-12.3.0-lib 76.8 36.2 8.8%
>
> However, I’d leave out gcc:debug because (0) it’s unrelated :-), (1)
> ‘gcc-final’ has no “debug” output, and (2) it’s really for a niche
> (folks developing compiler plugins, typically).
>
> I’d also leave out the /lib directory of Binutils, which is again rarely
> useful.
>
> WDYT?
>

I don't have any strong opinions on the organization here of these
outputs, happy to defer to whatever others decide here. It would be nice
to have this sorted and taken care of before we forget about it :)

However, I think this message from Kaelyn only went to the bug number
(just saw that as I went to reply here) so I'm including it here:

On Tue, May 09, 2023 at 06:50 PM, Kaelyn wrote:

Toggle quote (10 lines)
> Hi,
>
> I like the direction of this patch. However, if gcc-toolchain:lib is
> intended to provide the runtime libraries when the full compiler isn't
> needed, then I think the .a and .la files should be moved back to the
> main gcc-toolchain output (or a separate :static output) since they
> are for static linking and the .a files in particular can be sizeable.
>
> Cheers,
> Kaelyn
?