diff mbox series

[bug#74290,v2,04/40] gnu: gcc: Add indirections current-gcc, current-gcc-toolchain.

Message ID e43ac3adb6a1de703ebc8b02f9aa0b40be92ec24.1731427612.git.janneke@gnu.org
State New
Headers show
Series Add support for x86_64-gnu, aka the 64bit Hurd. | expand

Commit Message

Janneke Nieuwenhuizen Nov. 12, 2024, 4:25 p.m. UTC
Throughout: use (current-gcc) and (current-gcc-toolchain) instead of gcc and
gcc-toolchain.

* gnu/packages/gcc.scm (current-gcc): New procedure.
(gcc): Deprecate.
* gnu/packages/commencement.scm (current-gcc-toolchain): New procedure.
(gcc-toolchain): Deprecate.

Change-Id: I538897e53e2c9956abdc53c67621bb52cbd78a50
---
 gnu/packages/avr.scm            |  7 ++++---
 gnu/packages/benchmark.scm      |  6 ++++--
 gnu/packages/bootloaders.scm    |  2 +-
 gnu/packages/bootstrap.scm      |  4 ++--
 gnu/packages/c.scm              |  4 ++--
 gnu/packages/chicken.scm        |  7 ++++---
 gnu/packages/commencement.scm   | 33 +++++++++++++++++++--------------
 gnu/packages/containers.scm     |  5 +++--
 gnu/packages/cross-base.scm     |  4 ++--
 gnu/packages/dlang.scm          |  3 ++-
 gnu/packages/engineering.scm    |  4 ++--
 gnu/packages/gawk.scm           |  3 ++-
 gnu/packages/gcc.scm            | 21 ++++++++++++++-------
 gnu/packages/golang.scm         |  3 ++-
 gnu/packages/julia-xyz.scm      |  3 ++-
 gnu/packages/lisp.scm           |  3 ++-
 gnu/packages/llvm.scm           |  7 ++++---
 gnu/packages/make-bootstrap.scm | 20 ++++++++++----------
 gnu/packages/mpi.scm            |  3 ++-
 gnu/packages/parallel.scm       |  5 +++--
 gnu/packages/rocm.scm           |  3 ++-
 21 files changed, 88 insertions(+), 62 deletions(-)

Comments

Ludovic Courtès Nov. 17, 2024, 4:51 p.m. UTC | #1
Janneke Nieuwenhuizen <janneke@gnu.org> skribis:

> Throughout: use (current-gcc) and (current-gcc-toolchain) instead of gcc and
> gcc-toolchain.
>
> * gnu/packages/gcc.scm (current-gcc): New procedure.
> (gcc): Deprecate.
> * gnu/packages/commencement.scm (current-gcc-toolchain): New procedure.
> (gcc-toolchain): Deprecate.
>
> Change-Id: I538897e53e2c9956abdc53c67621bb52cbd78a50

I would have loved to avoid those indirections… but can we? :-)
diff mbox series

Patch

diff --git a/gnu/packages/avr.scm b/gnu/packages/avr.scm
index 6042c1bd55..00dc124aa9 100644
--- a/gnu/packages/avr.scm
+++ b/gnu/packages/avr.scm
@@ -5,6 +5,7 @@ 
 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
 ;;; Copyright © 2020 Arun Isaac <arunisaac@systemreboot.net>
 ;;; Copyright © 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2024 Janneke Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -53,7 +54,7 @@  (define make-avr-binutils
       (inherit (cross-binutils "avr"))
       (name "avr-binutils"))))
 
-(define* (make-avr-gcc/implementation #:key (xgcc gcc))
+(define* (make-avr-gcc/implementation #:key (xgcc (current-gcc)))
   "Return a XGCC-base cross-compiler for the AVR target."
   (let ((xgcc (cross-gcc "avr" #:xgcc xgcc #:xbinutils (make-avr-binutils))))
     (package
@@ -96,7 +97,7 @@  (define* (make-avr-gcc/implementation #:key (xgcc gcc))
               (variable "CROSS_LIBRARY_PATH")
               (files '("avr/lib")))))
       (native-inputs
-       `(("gcc" ,gcc)
+       `(("gcc" ,(current-gcc))
          ,@(package-native-inputs xgcc))))))
 
 (define make-avr-gcc
@@ -136,7 +137,7 @@  (define* (make-avr-libc/implementation #:key
 (define make-avr-libc
   (memoize make-avr-libc/implementation))
 
-(define* (make-avr-toolchain/implementation #:key (xgcc gcc))
+(define* (make-avr-toolchain/implementation #:key (xgcc (current-gcc)))
   (let ((avr-binutils (make-avr-binutils))
         (avr-libc (make-avr-libc #:xgcc (cross-gcc "avr" #:xgcc xgcc)))
         (avr-gcc (make-avr-gcc #:xgcc xgcc)))
diff --git a/gnu/packages/benchmark.scm b/gnu/packages/benchmark.scm
index 326bbc99b4..c802e105ed 100644
--- a/gnu/packages/benchmark.scm
+++ b/gnu/packages/benchmark.scm
@@ -13,6 +13,7 @@ 
 ;;; Copyright © 2021 Arun Isaac <arunisaac@systemreboot.net>
 ;;; Copyright © 2022 Tomasz Jeneralczyk <tj@schwi.pl>
 ;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
+;;; Copyright © 2024 Janneke Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -75,8 +76,8 @@  (define-module (gnu packages benchmark)
 
 ;; Lazily resolve the gcc-toolchain to avoid a circular dependency.
 (define gcc-toolchain*
-  (delay (module-ref (resolve-interface '(gnu packages commencement))
-                     'gcc-toolchain)))
+  (delay ((module-ref (resolve-interface '(gnu packages commencement))
+                      'current-gcc-toolchain))))
 
 (define-public fio
   (package
@@ -379,6 +380,7 @@  (define-public phoronix-test-suite
      (list bash
            coreutils
            (force gcc-toolchain*)
+           gcc-toolchain*
            gnu-make
            gzip
            php
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 52a077ecea..e188553910 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1710,7 +1710,7 @@  (define u-boot-ts-mx6
               (add-before 'build 'adjust-for-current-gcc
                 (lambda _
                   (let ((gcc-major-version #$(version-major
-                                              (package-version gcc))))
+                                              (package-version (current-gcc)))))
                     (copy-file "include/linux/compiler-gcc6.h"
                                (string-append "include/linux/compiler-gcc"
                                               gcc-major-version ".h")))
diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm
index 3743abf9fe..c4640b62e1 100644
--- a/gnu/packages/bootstrap.scm
+++ b/gnu/packages/bootstrap.scm
@@ -2,7 +2,7 @@ 
 ;;; Copyright © 2012-2020, 2024 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2014, 2015, 2018, 2019 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2017, 2020, 2024 Efraim Flashner <efraim@flashner.co.il>
-;;; Copyright © 2018, 2020, 2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+;;; Copyright © 2018, 2020, 2022, 2024 Janneke Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2019 Carl Dong <contact@carldong.me>
 ;;; Copyright © 2019 Léo Le Bouter <lle-bout@zaclys.net>
 ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
@@ -311,7 +311,7 @@  (define* (glibc-dynamic-linker
                                         gnu-triplet->nix-system)
                                  (%current-system))))
   "Return the name of Glibc's dynamic linker for SYSTEM."
-  ;; See the 'SYSDEP_KNOWN_INTERPRETER_NAMES' cpp macro in libc.
+  ;; See the appropriate 'shlib-versions' file in libc.
   (let ((platform (false-if-platform-not-found
                    (lookup-platform-by-system system))))
     (cond
diff --git a/gnu/packages/c.scm b/gnu/packages/c.scm
index 13fdb99424..f52a7c603e 100644
--- a/gnu/packages/c.scm
+++ b/gnu/packages/c.scm
@@ -6,7 +6,7 @@ 
 ;;; Copyright © 2019, 2020, 2022-2024 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2019, 2021 Guillaume Le Vaillant <glv@posteo.net>
 ;;; Copyright © 2019 Andreas Enge <andreas@enge.fr>
-;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+;;; Copyright © 2020, 2024 Janneke Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2020, 2021 Marius Bakke <marius@gnu.org>
 ;;; Copyright © 2020 Katherine Cox-Buday <cox.katherine.e@gmail.com>
 ;;; Copyright © 2020, 2022, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
@@ -178,7 +178,7 @@  (define-public cproc
                           (string-append "--with-ld=" #$(ld-for-target))
                           (string-append "--with-gcc-libdir=" gcc-lib))))))))
       (inputs `(("qbe" ,qbe)
-                ("gcc:lib" ,gcc "lib")))
+                ("gcc:lib" ,(current-gcc) "lib")))
       (supported-systems (list "x86_64-linux" "aarch64-linux"))
       (synopsis "Simple C11 compiler backed by QBE")
       (description "@code{cproc} is a C compiler using QBE as a backend,
diff --git a/gnu/packages/chicken.scm b/gnu/packages/chicken.scm
index a499c5d9ee..02674577ed 100644
--- a/gnu/packages/chicken.scm
+++ b/gnu/packages/chicken.scm
@@ -2,6 +2,7 @@ 
 ;;; Copyright © 2020 Ekaitz Zarraga <ekaitz@elenq.tech>
 ;;; Copyright © 2020 Evan Hanson <evhan@foldling.org>
 ;;; Copyright © 2020 raingloom <raingloom@riseup.net>
+;;; Copyright © 2024 Janneke Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -69,9 +70,9 @@  (define-public chicken
             (files (list "var/lib/chicken/11")))))
     ;; Reference gcc-toolchain lazily to avoid circular module dependency
     ;; problems.
-    (propagated-inputs (list (module-ref (resolve-interface
-                                          '(gnu packages commencement))
-                                         'gcc-toolchain)))
+    (propagated-inputs (list ((module-ref (resolve-interface
+                                           '(gnu packages commencement))
+                                          'current-gcc-toolchain))))
     (home-page "https://www.call-cc.org/")
     (synopsis "R5RS Scheme implementation that compiles native code via C")
     (description
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index 1cfaaae1e7..70641267a8 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -73,7 +73,8 @@  (define-module (gnu packages commencement)
   #:use-module (guix utils)
   #:use-module (srfi srfi-1)
   #:use-module (ice-9 vlist)
-  #:use-module (ice-9 match))
+  #:use-module (ice-9 match)
+  #:export (current-gcc-toolchain))
 
 ;;; Commentary:
 ;;;
@@ -908,7 +909,7 @@  (define gcc-core-mesboot0
   ;; with gcc-2.95.3, binutils (2.14.0, 2.20.1a) and glibc-2.2.5 we found a
   ;; GNU toolchain triplet "that works".
   (package
-    (inherit gcc)
+    (inherit (current-gcc))
     (name "gcc-core-mesboot0")
     (version "2.95.3")
     (source (origin
@@ -2319,19 +2320,19 @@  (define libstdc++-boot0-gcc7
 
 (define gcc-boot0
   (package
-    (inherit gcc)
+    (inherit (current-gcc))
     (name "gcc-cross-boot0")
-    (outputs (delete "debug" (package-outputs gcc)))
+    (outputs (delete "debug" (package-outputs (current-gcc))))
     (source
      (bootstrap-origin
       (origin
-        (inherit (package-source gcc))
+        (inherit (package-source (current-gcc)))
         (snippet
          #~(begin
              ;; XXX: The GCC test suite contains files with non-ASCII file
              ;; names, which cannot be repacked by BOOTSTRAP-ORIGIN.  Nor
              ;; can it be deleted from Guile, so resort to this evil hack.
-             #$(origin-snippet (package-source gcc))
+             #$(origin-snippet (package-source (current-gcc)))
              (system* #$(file-append (let-system system
                                        ;; 'coreutils-boot0' is Linux-only.
                                        (if (target-hurd? system)
@@ -2348,7 +2349,7 @@  (define gcc-boot0
                   (ice-9 regex)
                   (srfi srfi-1)
                   (srfi srfi-26))
-      (substitute-keyword-arguments (package-arguments gcc)
+      (substitute-keyword-arguments (package-arguments (current-gcc))
         ((#:configure-flags flags)
          #~(append (list #$(string-append "--target=" (boot-triplet))
 
@@ -2436,7 +2437,7 @@  (define gcc-boot0
                    (with-directory-excursion
                        (string-append out "/lib/gcc/"
                                       #$(boot-triplet)
-                                      "/" #$(package-version gcc))
+                                      "/" #$(package-version (current-gcc)))
                      (symlink "libgcc.a" "libgcc_eh.a"))))))))))
 
     (inputs `(("gmp-source" ,(bootstrap-origin (package-source gmp-6.0)))
@@ -2952,7 +2953,7 @@  (define/system-dependent glibc-final-with-bootstrap-bash
 (define (cross-gcc-wrapper gcc binutils glibc bash)
   "Return a wrapper for the pseudo-cross toolchain GCC/BINUTILS/GLIBC
 that makes it available under the native tool names."
-  (package (inherit gcc)
+  (package (inherit (current-gcc))
     (name (string-append (package-name gcc) "-wrapped"))
     (source #f)
     (build-system trivial-build-system)
@@ -3219,7 +3220,7 @@  (define gcc-final
                   (srfi srfi-26)
                   ,@%default-gnu-modules)
 
-      (substitute-keyword-arguments (package-arguments gcc)
+      (substitute-keyword-arguments (package-arguments (current-gcc))
         ((#:make-flags flags)
          ;; Since $LIBRARY_PATH is not honored, add the relevant flags.
          #~(let ((zlib (assoc-ref %build-inputs "zlib")))
@@ -3542,8 +3543,8 @@  (define* (make-gcc-toolchain gcc
   (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))
+      (name (string-append (package-name (current-gcc)) "-toolchain"))
+      (version (package-version (current-gcc)))
       (source #f)
       (build-system trivial-build-system)
       (arguments
@@ -3640,13 +3641,17 @@  (define-public gcc-toolchain-14
   (make-gcc-toolchain gcc-14))
 
 ;; The default GCC
-(define-public gcc-toolchain
+(define (current-gcc-toolchain)
+  "The current default gcc-toolchain version."
   gcc-toolchain-11)
 
+(define-public gcc-toolchain
+  (deprecated-package "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))
+  (deprecated-package "gcc" (current-gcc-toolchain)))
 
 
 (define-public gdc-toolchain-10
diff --git a/gnu/packages/containers.scm b/gnu/packages/containers.scm
index adae2f5bfc..80b9c6e03d 100644
--- a/gnu/packages/containers.scm
+++ b/gnu/packages/containers.scm
@@ -8,6 +8,7 @@ 
 ;;; Copyright © 2024 Tomas Volf <~@wolfsden.cz>
 ;;; Copyright © 2024 Foundation Devices, Inc. <hello@foundation.xyz>
 ;;; Copyright © 2024 Jean-Pierre De Jesus DIAZ <jean@foundation.xyz>
+;;; Copyright © 2024 Janneke Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -533,7 +534,7 @@  (define-public podman
                   (,(string-append #$catatonit      "/bin")
                    ,(string-append #$conmon         "/bin")
                    ,(string-append #$crun           "/bin")
-                   ,(string-append #$gcc            "/bin") ; cpp
+                   ,(string-append #$(current-gcc)  "/bin") ; cpp
                    ,(string-append #$iptables       "/sbin")
                    ,(string-append #$passt          "/bin")
                    ,(string-append #$procps         "/bin") ; ps
@@ -667,7 +668,7 @@  (define-public buildah
                   (,(string-append #$output "/_guix")))
                 `("PATH" suffix
                   (,(string-append #$crun           "/bin")
-                   ,(string-append #$gcc            "/bin") ; cpp
+                   ,(string-append #$(current-gcc)  "/bin") ; cpp
                    ,(string-append #$passt          "/bin")
                    "/run/privileged/bin")))))
           (add-after 'install 'install-completions
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index cecc21083e..9c701efae8 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -1,7 +1,7 @@ 
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2013-2018, 2020, 2023-2024 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2014, 2015, 2018 Mark H Weaver <mhw@netris.org>
-;;; Copyright © 2016, 2019, 2023 Janneke Nieuwenhuizen <janneke@gnu.org>
+;;; Copyright © 2016, 2019, 2023, 2024 Janneke Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2016 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2019, 2020, 2021 Marius Bakke <marius@gnu.org>
@@ -61,7 +61,7 @@  (define-syntax %xgcc
   ;;
   ;; Note: This is a macro so that we do not refer to 'gcc' from the top
   ;; level, which would lead to circular-dependency issues.
-  (identifier-syntax gcc))
+  (identifier-syntax (current-gcc)))
 
 (define %gcc-include-paths
   ;; Environment variables for header search paths.
diff --git a/gnu/packages/dlang.scm b/gnu/packages/dlang.scm
index 8bf0ee685e..654d5b2281 100644
--- a/gnu/packages/dlang.scm
+++ b/gnu/packages/dlang.scm
@@ -9,6 +9,7 @@ 
 ;;; Copyright © 2021, 2024 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2022 ( <paren@disroot.org>
 ;;; Copyright © 2022 Esther Flashner <esther@flashner.co.il>
+;;; Copyright © 2024 Janneke Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -426,7 +427,7 @@  (define dmd-bootstrap
     (build-system gnu-build-system)
     (arguments
      (list
-      #:disallowed-references (list (gexp-input (canonical-package gcc)
+      #:disallowed-references (list (gexp-input (canonical-package (current-gcc))
                                                 "lib"))
       ;; Disable tests, as gdmd cannot cope with some arguments used such as
       ;; '-conf'.
diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index 3ceeb4425a..5abca92ebf 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -2340,8 +2340,8 @@  (define-public freehdl
            coreutils
 
            ;; Lazily resolve the gcc-toolchain to avoid a circular dependency.
-           (module-ref (resolve-interface '(gnu packages commencement))
-                       'gcc-toolchain)
+           ((module-ref (resolve-interface '(gnu packages commencement))
+                        'current-gcc-toolchain))
 
            guile-2.2
            perl
diff --git a/gnu/packages/gawk.scm b/gnu/packages/gawk.scm
index 6a77a692f5..a8b8369d7b 100644
--- a/gnu/packages/gawk.scm
+++ b/gnu/packages/gawk.scm
@@ -4,6 +4,7 @@ 
 ;;; Copyright © 2018, 2022-2024 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2021, 2022 Marius Bakke <marius@gnu.org>
 ;;; Copyright © 2022 Paul A. Patience <paul@apatience.com>
+;;; Copyright © 2024 Janneke Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -227,7 +228,7 @@  (define-public cppawk
     (inputs
      (list coreutils                    ; For dirname, mktemp, printf, rm
            gawk-mpfr                    ; Default variant, but supports others
-           gcc                          ; For cpp
+           (current-gcc)                ; For cpp
            sed))
     (home-page "https://www.kylheku.com/cgit/cppawk/")
     (synopsis "Wrapper script that adds C preprocessing to Awk")
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index c9e475b676..3b5d05b9a9 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -17,6 +17,7 @@ 
 ;;; Copyright © 2023 Bruno Victal <mirai@makinata.eu>
 ;;; Copyright © 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2024 Nguyễn Gia Phong <mcsinyx@disroot.org>
+;;; Copyright © 2024 Janneke Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -57,7 +58,8 @@  (define-module (gnu packages gcc)
   #:use-module (guix utils)
   #:use-module (srfi srfi-1)
   #:use-module (ice-9 match)
-  #:use-module (ice-9 regex))
+  #:use-module (ice-9 regex)
+  #:export (current-gcc))
 
 (define %gcc-infrastructure
   ;; Base URL for GCC's infrastructure.
@@ -857,7 +859,12 @@  (define-public gcc-14
 
 ;; Note: When changing the default gcc version, update
 ;;       the gcc-toolchain-* definitions.
-(define-public gcc gcc-11)
+(define (current-gcc)
+  "The current default gcc version."
+  gcc-11)
+
+(define-public gcc
+  (deprecated-package "gcc" gcc-11))
 
 
 ;;;
@@ -868,7 +875,7 @@  (define-public gcc-2.95
   ;; Note: 'gcc-core-mesboot0' in commencement.scm provides 2.95 as well, but
   ;; with additional tricks to support compilation with TinyCC and Mes-libc.
   (package
-    (inherit gcc)
+    (inherit (current-gcc))
     (version "2.95.3")
     (source (origin
               (method url-fetch)
@@ -1045,7 +1052,7 @@  (define-public (make-libstdc++ gcc)
 
 (define libstdc++
   ;; Libstdc++ matching the default GCC.
-  (make-libstdc++ gcc))
+  (make-libstdc++ (current-gcc)))
 
 (define libstdc++-headers
   ;; XXX: This package is for internal use to work around
@@ -1100,7 +1107,7 @@  (define (make-libiberty gcc)
     (synopsis "Collection of subroutines used by various GNU programs")))
 
 (define-public libiberty
-  (make-libiberty gcc))
+  (make-libiberty (current-gcc)))
 
 (define* (custom-gcc gcc name languages
                      #:optional
@@ -1157,7 +1164,7 @@  (define-public gfortran-13
 
 (define-public gfortran
   (hidden-package
-   (custom-gcc gcc
+   (custom-gcc (current-gcc)
                "gfortran" '("fortran")
                %generic-search-paths)))
 
@@ -1186,7 +1193,7 @@  (define-public gdc-11
 ;;; Alias tracking the latest GDC version.
 (define-public gdc
   (hidden-package
-   (custom-gcc gcc "gdc" '("d")
+   (custom-gcc (current-gcc) "gdc" '("d")
                %generic-search-paths)))
 
 (define-public (make-libgccjit gcc)
diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 894e878cf2..244e85f17c 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -47,6 +47,7 @@ 
 ;;; Copyright © 2024 Greg Hogan <code@greghogan.com>
 ;;; Copyright © 2024 Brennan Vincent <brennan@umanwizard.com>
 ;;; Copyright © 2024 André Batista <nandre@riseup.net>
+;;; Copyright © 2024 Janneke Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -253,7 +254,7 @@  (define-public go-1.4
     (inputs
      `(("tzdata" ,tzdata)
        ("pcre" ,pcre)
-       ("gcc:lib" ,(canonical-package gcc) "lib")))
+       ("gcc:lib" ,(canonical-package (current-gcc)) "lib")))
     (native-inputs
      (list pkg-config which net-base perl))
 
diff --git a/gnu/packages/julia-xyz.scm b/gnu/packages/julia-xyz.scm
index 77385ee6e0..3860da608e 100644
--- a/gnu/packages/julia-xyz.scm
+++ b/gnu/packages/julia-xyz.scm
@@ -6,6 +6,7 @@ 
 ;;; Copyright © 2021 jgart <jgart@dismail.de>
 ;;; Copyright © 2023 Sharlatan Hellseher <sharlatanus@gmail.com>
 ;;; Copyright © 2024 Spencer King <spencer.king@geneoscopy.com>
+;;; Copyright © 2024 Janneke Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -5170,7 +5171,7 @@  (define-public julia-quadmath
     (propagated-inputs
      (list julia-requires))
     (inputs
-     `(("gcc:lib" ,gcc "lib")))
+     `(("gcc:lib" ,(current-gcc) "lib")))
     (native-inputs
      (list julia-specialfunctions))
     (home-page "https://github.com/JuliaMath/Quadmath.jl")
diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm
index 6c16d8ab71..8dc3208327 100644
--- a/gnu/packages/lisp.scm
+++ b/gnu/packages/lisp.scm
@@ -29,6 +29,7 @@ 
 ;;; Copyright © 2024 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2024 bigbug <bigbookofbug@proton.me>
 ;;; Copyright © 2024 Ashish SHUKLA <ashish.is@lostca.se>
+;;; Copyright © 2024 Janneke Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -388,7 +389,7 @@  (define-public clasp-cl
         (base32 "10jjhcid6qp64gx29iyy5rqqijwy8hrvx66f0xabdj8w3007ky39"))))
     (build-system gnu-build-system)
     (inputs
-     (list boost clang-15 fmt `(,gcc "lib") gmp libelf libunwind llvm-15))
+     (list boost clang-15 fmt `(,(current-gcc) "lib") gmp libelf libunwind llvm-15))
     (native-inputs
      (list binutils-gold ninja pkg-config sbcl))
     (arguments
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index c6566a3339..1d4a7f5277 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -27,6 +27,7 @@ 
 ;;; Copyright © 2022 Zhu Zihao <all_but_last@163.com>
 ;;; Copyright © 2023 Hilton Chain <hako@ultrarare.space>
 ;;; Copyright © 2023, 2024 Zheng Junjie <873216071@qq.com>
+;;; Copyright © 2024 Janneke Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -89,8 +90,8 @@  (define-module (gnu packages llvm)
 
 ;; Lazily resolve the gcc-toolchain to avoid a circular dependency.
 (define gcc-toolchain*
-  (delay (module-ref (resolve-interface '(gnu packages commencement))
-                     'gcc-toolchain)))
+  (delay ((module-ref (resolve-interface '(gnu packages commencement))
+                      'current-gcc-toolchain))))
 
 (define* (system->llvm-target #:optional
                               (system (or (and=> (%current-target-system)
@@ -250,7 +251,7 @@  (define* (clang-from-llvm llvm clang-runtime
     (native-inputs (package-native-inputs llvm))
     (inputs
      `(("libxml2" ,libxml2)
-       ("gcc-lib" ,gcc "lib")
+       ("gcc-lib" ,(current-gcc) "lib")
        ,@(package-inputs llvm)
        ,@(if tools-extra
              `(("clang-tools-extra" ,tools-extra))
diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm
index edc536bff4..c6293b9a38 100644
--- a/gnu/packages/make-bootstrap.scm
+++ b/gnu/packages/make-bootstrap.scm
@@ -3,7 +3,7 @@ 
 ;;; Copyright © 2017, 2021 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018, 2019 Mark H Weaver <mhw@netris.org>
-;;; Copyright © 2018, 2019, 2021, 2022, 2023 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+;;; Copyright © 2018, 2019, 2021, 2022, 2023, 2024 Janneke Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2019, 2020, 2022 Marius Bakke <marius@gnu.org>
 ;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;; Copyright © 2021 Pierre Langlois <pierre.langlois@gmx.com>
@@ -108,13 +108,13 @@  (define gcc-for-bootstrap
   (mlambdaq (glibc)
     "Return a variant of GCC that uses the bootstrap variant of GLIBC."
     (package
-      (inherit gcc)
+      (inherit (current-gcc))
       (outputs '("out")) ;all in one so libgcc_s is easily found
       (inputs
        `( ;; Distinguish the name so we can refer to it below.
          ("bootstrap-libc" ,(glibc-for-bootstrap glibc))
          ("libc:static" ,(glibc-for-bootstrap glibc) "static")
-         ,@(package-inputs gcc))))))
+         ,@(package-inputs (current-gcc)))))))
 
 (define (package-with-relocatable-glibc p)
   "Return a variant of P that uses the libc as defined by
@@ -153,7 +153,7 @@  (define (package-with-relocatable-glibc p)
                              (cons (search-path-specification
                                     (variable "CROSS_CPLUS_INCLUDE_PATH")
                                     (files '("include")))
-                                   (package-search-paths gcc)))))
+                                   (package-search-paths (current-gcc))))))
             ("cross-binutils" ,(cross-binutils target))
             ,@(%final-inputs)))
         `(("libc" ,(glibc-for-bootstrap glibc))
@@ -481,11 +481,11 @@  (define (%glibc-stripped)
 (define %gcc-static
   ;; A statically-linked GCC, with stripped-down functionality.
   (package-with-relocatable-glibc
-   (package (inherit gcc)
+   (package (inherit (current-gcc))
      (name "gcc-static")
      (outputs '("out"))                           ; all in one
      (arguments
-      (substitute-keyword-arguments (package-arguments gcc)
+      (substitute-keyword-arguments (package-arguments (current-gcc))
         ((#:modules modules %default-gnu-modules)
          `((srfi srfi-1)
            (srfi srfi-26)
@@ -536,7 +536,7 @@  (define %gcc-static
      (inputs
       `(("zlib:static" ,zlib "static")
         ("isl:static" ,isl "static")
-        ,@(package-inputs gcc)))
+        ,@(package-inputs (current-gcc))))
      (native-inputs
       (if (%current-target-system)
           `(;; When doing a Canadian cross, we need GMP/MPFR/MPC both
@@ -549,13 +549,13 @@  (define %gcc-static
             ("gmp-native" ,gmp)
             ("mpfr-native" ,mpfr)
             ("mpc-native" ,mpc)
-            ,@(package-native-inputs gcc))
-          (package-native-inputs gcc))))))
+            ,@(package-native-inputs (current-gcc)))
+          (package-native-inputs (current-gcc)))))))
 
 (define %gcc-stripped
   ;; The subset of GCC files needed for bootstrap.
   (package
-    (inherit gcc)
+    (inherit (current-gcc))
     (name "gcc-stripped")
     (build-system trivial-build-system)
     (source #f)
diff --git a/gnu/packages/mpi.scm b/gnu/packages/mpi.scm
index bc1fd797d6..e956167137 100644
--- a/gnu/packages/mpi.scm
+++ b/gnu/packages/mpi.scm
@@ -9,6 +9,7 @@ 
 ;;; Copyright © 2018 Paul Garlick <pgarlick@tourbillion-technology.com>
 ;;; Copyright © 2019, 2021 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2024 Romain Garbage <romain.garbage@inria.fr>
+;;; Copyright © 2024 Janneke Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -378,7 +379,7 @@  (define-public openmpi-5
                                   "ompi/tools/ompi_info/param.c")
                      (("_ABSOLUTE") "")))))
 
-           #:disallowed-references (list (canonical-package gcc))))))
+           #:disallowed-references (list (canonical-package (current-gcc)))))))
 
 (define-public openmpi-c++
   (package/inherit openmpi
diff --git a/gnu/packages/parallel.scm b/gnu/packages/parallel.scm
index 7459a6a02c..e13bf04277 100644
--- a/gnu/packages/parallel.scm
+++ b/gnu/packages/parallel.scm
@@ -15,6 +15,7 @@ 
 ;;; Copyright © 2024 Zheng Junjie <873216071@qq.com>
 ;;; Copyright © 2024 David Elsing <david.elsing@posteo.net>
 ;;; Copyright © 2024 Romain Garbage <romain.garbage@inria.fr>
+;;; Copyright © 2024 Janneke Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -666,7 +667,7 @@  (define-public openpmix
 
           ;; Don't keep a reference to GCC.
           #:disallowed-references (and (not (%current-target-system))
-                                       (list (canonical-package gcc)))
+                                       (list (canonical-package (current-gcc))))
 
           #:phases
           #~(modify-phases %standard-phases
@@ -738,7 +739,7 @@  (define-public prrte
                      (string-append "prte_launch_agent = \""
                                     #$output "/bin/prted\";\n"))))))
 
-          #:disallowed-references (list (canonical-package gcc))))
+          #:disallowed-references (list (canonical-package (current-gcc)))))
    (inputs (list libevent
                  `(,hwloc "lib")
                  openpmix))
diff --git a/gnu/packages/rocm.scm b/gnu/packages/rocm.scm
index e883371928..2f315e3985 100644
--- a/gnu/packages/rocm.scm
+++ b/gnu/packages/rocm.scm
@@ -1,6 +1,7 @@ 
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2021 Lars-Dominik Braun <lars@6xq.net>
 ;;; Copyright © 2022, 2023 John Kehayias <john.kehayias@protonmail.com>
+;;; Copyright © 2024 Janneke Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; This program is free software; you can redistribute it and/or modify it
 ;;; under the terms of the GNU General Public License as published by
@@ -131,7 +132,7 @@  (define-public roct-thunk-interface
     (build-system cmake-build-system)
     (arguments `(#:tests? #f)) ; Not sure how to run tests.
     (inputs (list libdrm numactl))
-    (native-inputs (list `(,gcc "lib") pkg-config))
+    (native-inputs (list `(,(current-gcc) "lib") pkg-config))
     (home-page "https://github.com/RadeonOpenCompute/ROCT-Thunk-Interface")
     (synopsis "Radeon Open Compute Thunk Interface")
     (description "User-mode API interfaces used to interact with the ROCk