GNU bug report logs - #63329
[PATCH] gnu: Use gexps for gcc-boot0 and related packages.

Previous Next

Package: guix-patches;

Reported by: Christopher Baines <mail <at> cbaines.net>

Date: Sat, 6 May 2023 13:23:02 UTC

Severity: normal

Tags: patch

Done: Christopher Baines <mail <at> cbaines.net>

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 63329 in the body.
You can then email your comments to 63329 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#63329; Package guix-patches. (Sat, 06 May 2023 13:23:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Christopher Baines <mail <at> cbaines.net>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sat, 06 May 2023 13:23:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Christopher Baines <mail <at> cbaines.net>
To: guix-patches <at> gnu.org
Subject: [PATCH] gnu: Use gexps for gcc-boot0 and related packages.
Date: Sat,  6 May 2023 14:22:29 +0100
There are currently problems with native or cross building for i586-gnu, and
one factor mixed up with this is that some of the gcc packages use sexp's for
the phases, and thus introducing gexp's has caused problems.

As part of the going in circles with this, this commit switches gcc-boot0 to
use gexp's in it's arguments, and then also modifies libstdc++-boot0,
cross-gcc-wrapper, gcc-final and make-libstdc++ to handle this change.

If done correctly, this change shouldn't affect any derivations.

* gnu/packages/commencement.scm (libstdc++-boot0, gcc-boot0,
gcc-final)[arguments]: Use gexps.
(cross-gcc-wrapper): Use gexps in the generated package.
* gnu/packages/gcc.scm (make-libstdc++): Use gexps in the generated package.
---
 gnu/packages/commencement.scm | 377 +++++++++++++++++-----------------
 gnu/packages/gcc.scm          | 109 +++++-----
 2 files changed, 245 insertions(+), 241 deletions(-)

diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index fc1c508b38..5e47b272e4 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -2259,13 +2259,13 @@ (define libstdc++-boot0
              ((or "i686-linux" "x86_64-linux")
               (substitute-keyword-arguments (package-arguments lib)
                 ((#:phases phases)
-                 `(modify-phases ,phases
-                    (add-after 'unpack 'workaround-wrapper-bug
-                      ;; XXX: The crude gcc-cross-wrapper causes "g++ -v" to
-                      ;; fail, which in turn confuses the configure script.
-                      (lambda _
-                        (substitute* "libstdc++-v3/configure"
-                          (("g\\+\\+ -v") "true"))))))))
+                 #~(modify-phases #$phases
+                     (add-after 'unpack 'workaround-wrapper-bug
+                       ;; XXX: The crude gcc-cross-wrapper causes "g++ -v" to
+                       ;; fail, which in turn confuses the configure script.
+                       (lambda _
+                         (substitute* "libstdc++-v3/configure"
+                           (("g\\+\\+ -v") "true"))))))))
              (_ (package-arguments lib)))
 
          ;; Explicitly add #:modules so MAKE-LIBSTDC++ can be changed
@@ -2338,81 +2338,82 @@ (define gcc-boot0
              (system* #$(file-append coreutils-boot0 "/bin/rm") "-rf"
                       "gcc/testsuite/go.test/test/fixedbugs/issue27836.dir"))))))
     (arguments
-     `(#:guile ,%bootstrap-guile
-       #:implicit-inputs? #f
-       #:modules ((guix build gnu-build-system)
+     (cons*
+      #:guile %bootstrap-guile
+      #:implicit-inputs? #f
+      #:modules '((guix build gnu-build-system)
                   (guix build utils)
                   (ice-9 regex)
                   (srfi srfi-1)
                   (srfi srfi-26))
-       ,@(substitute-keyword-arguments (package-arguments gcc)
-           ((#:configure-flags flags)
-            `(append (list ,(string-append "--target=" (boot-triplet))
-
-                           ;; No libc yet.
-                           "--without-headers"
-
-                           ;; Disable features not needed at this stage.
-                           "--disable-shared"
-                           "--enable-languages=c,c++"
-
-                           ;; libstdc++ cannot be built at this stage
-                           ;; ("Link tests are not allowed after
-                           ;; GCC_NO_EXECUTABLES.").
-                           "--disable-libstdc++-v3"
-
-                           "--disable-threads"
-                           "--disable-libmudflap"
-                           "--disable-libatomic"
-                           "--disable-libsanitizer"
-                           "--disable-libitm"
-                           "--disable-libgomp"
-                           "--disable-libmpx"
-                           "--disable-libcilkrts"
-                           "--disable-libvtv"
-                           "--disable-libssp"
-                           "--disable-libquadmath"
-                           "--disable-decimal-float")
-                     (remove (cut string-match
-                               "--(with-system-zlib|enable-languages.*)" <>)
-                             ,flags)))
-           ((#:make-flags flags)
-            `(let* ((libc        (assoc-ref %build-inputs "libc"))
-                    (libc-native (or (assoc-ref %build-inputs "libc-native")
-                                     libc)))
-               `(,(string-append "LDFLAGS="
-                                 "-Wl,-rpath=" libc-native "/lib "
-                                 "-Wl,-dynamic-linker "
-                                 "-Wl," libc-native ,(glibc-dynamic-linker
-                                                      (match (%current-system)
-                                                        ("x86_64-linux" "i686-linux")
-                                                        (_ (%current-system))))))))
-           ((#:phases phases)
-            `(modify-phases ,phases
-               (add-after 'unpack 'unpack-gmp&co
-                 (lambda* (#:key inputs #:allow-other-keys)
-                   (let ((gmp  (assoc-ref %build-inputs "gmp-source"))
-                         (mpfr (assoc-ref %build-inputs "mpfr-source"))
-                         (mpc  (assoc-ref %build-inputs "mpc-source")))
-
-                     ;; To reduce the set of pre-built bootstrap inputs, build
-                     ;; GMP & co. from GCC.
-                     (for-each (lambda (source)
-                                 (invoke "tar" "xvf" source))
-                               (list gmp mpfr mpc))
-
-                     ;; Create symlinks like `gmp' -> `gmp-x.y.z'.
-                     ,@(map (lambda (lib)
-                              ;; Drop trailing letters, as gmp-6.0.0a unpacks
-                              ;; into gmp-6.0.0.
-                              `(symlink ,(string-trim-right
-                                          (package-full-name lib "-")
-                                          char-set:letter)
-                                        ,(package-name lib)))
-                            (list gmp-6.0 mpfr mpc)))))
-               ,(match (%current-system)
-                  ((or "i686-linux" "x86_64-linux")
-                   '(add-before 'configure 'fix-libcc1
+      (substitute-keyword-arguments (package-arguments gcc)
+        ((#:configure-flags flags)
+         #~(append (list #$(string-append "--target=" (boot-triplet))
+
+                         ;; No libc yet.
+                         "--without-headers"
+
+                         ;; Disable features not needed at this stage.
+                         "--disable-shared"
+                         "--enable-languages=c,c++"
+
+                         ;; libstdc++ cannot be built at this stage
+                         ;; ("Link tests are not allowed after
+                         ;; GCC_NO_EXECUTABLES.").
+                         "--disable-libstdc++-v3"
+
+                         "--disable-threads"
+                         "--disable-libmudflap"
+                         "--disable-libatomic"
+                         "--disable-libsanitizer"
+                         "--disable-libitm"
+                         "--disable-libgomp"
+                         "--disable-libmpx"
+                         "--disable-libcilkrts"
+                         "--disable-libvtv"
+                         "--disable-libssp"
+                         "--disable-libquadmath"
+                         "--disable-decimal-float")
+                   (remove (cut string-match
+                                "--(with-system-zlib|enable-languages.*)" <>)
+                           #$flags)))
+        ((#:make-flags flags)
+         `(let* ((libc        (assoc-ref %build-inputs "libc"))
+                 (libc-native (or (assoc-ref %build-inputs "libc-native")
+                                  libc)))
+            `(,(string-append "LDFLAGS="
+                              "-Wl,-rpath=" libc-native "/lib "
+                              "-Wl,-dynamic-linker "
+                              "-Wl," libc-native ,(glibc-dynamic-linker
+                                                   (match (%current-system)
+                                                     ("x86_64-linux" "i686-linux")
+                                                     (_ (%current-system))))))))
+        ((#:phases phases)
+         #~(modify-phases #$phases
+             (add-after 'unpack 'unpack-gmp&co
+               (lambda* (#:key inputs #:allow-other-keys)
+                 (let ((gmp  (assoc-ref %build-inputs "gmp-source"))
+                       (mpfr (assoc-ref %build-inputs "mpfr-source"))
+                       (mpc  (assoc-ref %build-inputs "mpc-source")))
+
+                   ;; To reduce the set of pre-built bootstrap inputs, build
+                   ;; GMP & co. from GCC.
+                   (for-each (lambda (source)
+                               (invoke "tar" "xvf" source))
+                             (list gmp mpfr mpc))
+
+                   ;; Create symlinks like `gmp' -> `gmp-x.y.z'.
+                   #$@(map (lambda (lib)
+                             ;; Drop trailing letters, as gmp-6.0.0a unpacks
+                             ;; into gmp-6.0.0.
+                             #~(symlink #$(string-trim-right
+                                           (package-full-name lib "-")
+                                           char-set:letter)
+                                        #$(package-name lib)))
+                           (list gmp-6.0 mpfr mpc)))))
+             #$(match (%current-system)
+                 ((or "i686-linux" "x86_64-linux")
+                  #~(add-before 'configure 'fix-libcc1
                       (lambda* (#:key inputs #:allow-other-keys)
                         ;; libcc1.so NEEDs libgcc_s.so, so provide one here
                         ;; to placate the 'validate-runpath' phase.
@@ -2423,18 +2424,18 @@ (define gcc-boot0
                         ;; XXX: "g++ -v" is broken (see also libstdc++ above).
                         (substitute* "libcc1/configure"
                           (("g\\+\\+ -v") "true")))))
-                  (_ '(add-before 'configure 'return-true
+                 (_ #~(add-before 'configure 'return-true
                         (lambda _ #t))))
-               (add-after 'install 'symlink-libgcc_eh
-                 (lambda* (#:key outputs #:allow-other-keys)
-                   (let ((out (assoc-ref outputs "lib")))
-                     ;; Glibc wants to link against libgcc_eh, so provide
-                     ;; it.
-                     (with-directory-excursion
-                         (string-append out "/lib/gcc/"
-                                        ,(boot-triplet)
-                                        "/" ,(package-version gcc))
-                       (symlink "libgcc.a" "libgcc_eh.a"))))))))))
+             (add-after 'install 'symlink-libgcc_eh
+               (lambda* (#:key outputs #:allow-other-keys)
+                 (let ((out (assoc-ref outputs "lib")))
+                   ;; Glibc wants to link against libgcc_eh, so provide
+                   ;; it.
+                   (with-directory-excursion
+                       (string-append out "/lib/gcc/"
+                                      #$(boot-triplet)
+                                      "/" #$(package-version gcc))
+                     (symlink "libgcc.a" "libgcc_eh.a"))))))))))
 
     (inputs `(("gmp-source" ,(bootstrap-origin (package-source gmp-6.0)))
               ("mpfr-source" ,(bootstrap-origin (package-source mpfr)))
@@ -2888,41 +2889,42 @@ (define (cross-gcc-wrapper gcc binutils glibc bash)
     (build-system trivial-build-system)
     (outputs '("out"))
     (arguments
-     `(#:guile ,%bootstrap-guile
-       #:modules ((guix build utils))
-       #:builder (begin
-                   (use-modules (guix build utils))
-
-                   (let* ((binutils (assoc-ref %build-inputs "binutils"))
-                          (gcc      (assoc-ref %build-inputs "gcc"))
-                          (libc     (assoc-ref %build-inputs "libc"))
-                          (bash     (assoc-ref %build-inputs "bash"))
-                          (out      (assoc-ref %outputs "out"))
-                          (bindir   (string-append out "/bin"))
-                          (triplet  ,(boot-triplet)))
-                     (define (wrap-program program)
-                       ;; GCC-BOOT0 is a libc-less cross-compiler, so it
-                       ;; needs to be told where to find the crt files and
-                       ;; the dynamic linker.
-                       (call-with-output-file program
-                         (lambda (p)
-                           (format p "#!~a/bin/bash
+     (list
+      #:guile %bootstrap-guile
+      #:modules '((guix build utils))
+      #:builder #~(begin
+                    (use-modules (guix build utils))
+
+                    (let* ((binutils (assoc-ref %build-inputs "binutils"))
+                           (gcc      (assoc-ref %build-inputs "gcc"))
+                           (libc     (assoc-ref %build-inputs "libc"))
+                           (bash     (assoc-ref %build-inputs "bash"))
+                           (out      (assoc-ref %outputs "out"))
+                           (bindir   (string-append out "/bin"))
+                           (triplet  #$(boot-triplet)))
+                      (define (wrap-program program)
+                        ;; GCC-BOOT0 is a libc-less cross-compiler, so it
+                        ;; needs to be told where to find the crt files and
+                        ;; the dynamic linker.
+                        (call-with-output-file program
+                          (lambda (p)
+                            (format p "#!~a/bin/bash
 exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
-                                   bash
-                                   gcc triplet program
-                                   libc libc
-                                   ,(glibc-dynamic-linker))))
-
-                       (chmod program #o555))
-
-                     (mkdir-p bindir)
-                     (with-directory-excursion bindir
-                       (for-each (lambda (tool)
-                                   (symlink (string-append binutils "/bin/"
-                                                           triplet "-" tool)
-                                            tool))
-                                 '("ar" "ranlib"))
-                       (for-each wrap-program '("gcc" "g++")))))))
+                                    bash
+                                    gcc triplet program
+                                    libc libc
+                                    #$(glibc-dynamic-linker))))
+
+                        (chmod program #o555))
+
+                      (mkdir-p bindir)
+                      (with-directory-excursion bindir
+                        (for-each (lambda (tool)
+                                    (symlink (string-append binutils "/bin/"
+                                                            triplet "-" tool)
+                                             tool))
+                                  '("ar" "ranlib"))
+                        (for-each wrap-program '("gcc" "g++")))))))
     (native-inputs
      `(("binutils" ,binutils)
        ("gcc" ,gcc)
@@ -3122,79 +3124,80 @@ (define gcc-final
     (outputs (delete "debug" (package-outputs gcc-boot0)))
 
     (arguments
-     `(#:guile ,%bootstrap-guile
-       #:implicit-inputs? #f
+     (cons*
+      #:guile %bootstrap-guile
+      #:implicit-inputs? #f
 
-       #:allowed-references ("out" "lib" ,zlib-final
+      #:allowed-references `("out" "lib" ,zlib-final
                              ,glibc-final ,static-bash-for-glibc)
 
-       ;; Things like libasan.so and libstdc++.so NEED ld.so for some
-       ;; reason, but it is not in their RUNPATH.  This is a false
-       ;; positive, so turn it off.
-       #:validate-runpath? #f
+      ;; Things like libasan.so and libstdc++.so NEED ld.so for some
+      ;; reason, but it is not in their RUNPATH.  This is a false
+      ;; positive, so turn it off.
+      #:validate-runpath? #f
 
-       ;; Additional modules for the libstdc++ phase below.
-       #:modules ((srfi srfi-1)
+      ;; Additional modules for the libstdc++ phase below.
+      #:modules `((srfi srfi-1)
                   (srfi srfi-26)
                   ,@%gnu-build-system-modules)
 
-       ,@(substitute-keyword-arguments (package-arguments gcc)
-           ((#:make-flags flags)
-            ;; Since $LIBRARY_PATH is not honored, add the relevant flags.
-            `(let ((zlib (assoc-ref %build-inputs "zlib")))
-               (map (lambda (flag)
-                      (if (string-prefix? "LDFLAGS=" flag)
-                          (string-append flag " -L"
-                                         (assoc-ref %build-inputs "libstdc++")
-                                         "/lib -L" zlib "/lib -Wl,-rpath="
-                                         zlib "/lib")
-                          flag))
-                    ,flags)))
-           ;; Build again GMP & co. within GCC's build process, because it's hard
-           ;; to do outside (because GCC-BOOT0 is a cross-compiler, and thus
-           ;; doesn't honor $LIBRARY_PATH, which breaks `gnu-build-system'.)
-           ((#:phases phases)
-            `(modify-phases ,phases
-                (add-after 'unpack 'unpack-gmp&co
-                  (lambda* (#:key inputs #:allow-other-keys)
-                    (let ((gmp  (assoc-ref %build-inputs "gmp-source"))
-                          (mpfr (assoc-ref %build-inputs "mpfr-source"))
-                          (mpc  (assoc-ref %build-inputs "mpc-source")))
-
-                      ;; To reduce the set of pre-built bootstrap inputs, build
-                      ;; GMP & co. from GCC.
-                      (for-each (lambda (source)
-                                  (invoke "tar" "xvf" source))
-                                (list gmp mpfr mpc))
-
-                      ;; Create symlinks like `gmp' -> `gmp-x.y.z'.
-                      ,@(map (lambda (lib)
-                               ;; Drop trailing letters, as gmp-6.0.0a unpacks
-                               ;; into gmp-6.0.0.
-                               `(symlink ,(string-trim-right
+      (substitute-keyword-arguments (package-arguments gcc)
+        ((#:make-flags flags)
+         ;; Since $LIBRARY_PATH is not honored, add the relevant flags.
+         #~(let ((zlib (assoc-ref %build-inputs "zlib")))
+             (map (lambda (flag)
+                    (if (string-prefix? "LDFLAGS=" flag)
+                        (string-append flag " -L"
+                                       (assoc-ref %build-inputs "libstdc++")
+                                       "/lib -L" zlib "/lib -Wl,-rpath="
+                                       zlib "/lib")
+                        flag))
+                  #$flags)))
+        ;; Build again GMP & co. within GCC's build process, because it's hard
+        ;; to do outside (because GCC-BOOT0 is a cross-compiler, and thus
+        ;; doesn't honor $LIBRARY_PATH, which breaks `gnu-build-system'.)
+        ((#:phases phases)
+         #~(modify-phases #$phases
+             (add-after 'unpack 'unpack-gmp&co
+               (lambda* (#:key inputs #:allow-other-keys)
+                 (let ((gmp  (assoc-ref %build-inputs "gmp-source"))
+                       (mpfr (assoc-ref %build-inputs "mpfr-source"))
+                       (mpc  (assoc-ref %build-inputs "mpc-source")))
+
+                   ;; To reduce the set of pre-built bootstrap inputs, build
+                   ;; GMP & co. from GCC.
+                   (for-each (lambda (source)
+                               (invoke "tar" "xvf" source))
+                             (list gmp mpfr mpc))
+
+                   ;; Create symlinks like `gmp' -> `gmp-x.y.z'.
+                   #$@(map (lambda (lib)
+                             ;; Drop trailing letters, as gmp-6.0.0a unpacks
+                             ;; into gmp-6.0.0.
+                             #~(symlink #$(string-trim-right
                                            (package-full-name lib "-")
                                            char-set:letter)
-                                         ,(package-name lib)))
-                             (list gmp-6.0 mpfr mpc)))))
-                (add-after 'unpack 'fix-build-with-external-libstdc++
-                  (lambda* (#:key inputs #:allow-other-keys)
-                    (let ((libstdc++ (assoc-ref inputs "libstdc++")))
-                      ;; Fix a regression in GCC 11 where the libstc++ input
-                      ;; shadows glibc headers when building libstdc++.  An
-                      ;; upstream fix was added in GCC 11.3.0, but it only
-                      ;; hides system include directories, not those on
-                      ;; CPLUS_INCLUDE_PATH.  See discussion at
-                      ;; <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100017>.
-                      (substitute* "libstdc++-v3/src/c++17/Makefile.in"
-                        (("AM_CXXFLAGS = ")
-                         (string-append "CPLUS_INCLUDE_PATH = "
-                                        (string-join
-                                         (remove (cut string-prefix? libstdc++ <>)
-                                                 (string-split
-                                                  (getenv "CPLUS_INCLUDE_PATH")
-                                                  #\:))
-                                         ":")
-                                        "\nAM_CXXFLAGS = ")))))))))))
+                                        #$(package-name lib)))
+                           (list gmp-6.0 mpfr mpc)))))
+             (add-after 'unpack 'fix-build-with-external-libstdc++
+               (lambda* (#:key inputs #:allow-other-keys)
+                 (let ((libstdc++ (assoc-ref inputs "libstdc++")))
+                   ;; Fix a regression in GCC 11 where the libstc++ input
+                   ;; shadows glibc headers when building libstdc++.  An
+                   ;; upstream fix was added in GCC 11.3.0, but it only
+                   ;; hides system include directories, not those on
+                   ;; CPLUS_INCLUDE_PATH.  See discussion at
+                   ;; <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100017>.
+                   (substitute* "libstdc++-v3/src/c++17/Makefile.in"
+                     (("AM_CXXFLAGS = ")
+                      (string-append "CPLUS_INCLUDE_PATH = "
+                                     (string-join
+                                      (remove (cut string-prefix? libstdc++ <>)
+                                              (string-split
+                                               (getenv "CPLUS_INCLUDE_PATH")
+                                               #\:))
+                                      ":")
+                                     "\nAM_CXXFLAGS = ")))))))))))
 
     ;; This time we want Texinfo, so we get the manual.  Add
     ;; STATIC-BASH-FOR-GLIBC so that it's used in the final shebangs of
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index fade5bb64b..d1c79b8dc2 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -864,62 +864,63 @@ (define-public (make-libstdc++ gcc)
     (inherit gcc)
     (name "libstdc++")
     (arguments
-     `(#:out-of-source? #t
-       #:modules ((srfi srfi-1)
+     (list
+      #:out-of-source? #t
+      #:modules `((srfi srfi-1)
                   (srfi srfi-26)
                   ,@%gnu-build-system-modules)
-       #:phases
-       (modify-phases %standard-phases
-         ,@(if (version>=? (package-version gcc) "11")
-               `((add-after 'unpack 'hide-gcc-headers
-                   (lambda* (#:key native-inputs inputs #:allow-other-keys)
-                     (let ((gcc (assoc-ref (or native-inputs inputs)
-                                           ,(if (%current-target-system)
-                                                "cross-gcc"
-                                                "gcc"))))
-                       ;; Fix a regression in GCC 11 where the GCC headers
-                       ;; shadows glibc headers when building libstdc++.  An
-                       ;; upstream fix was added in GCC 11.3.0, but it only
-                       ;; hides system include directories, not those on
-                       ;; CPLUS_INCLUDE_PATH.  See discussion at
-                       ;; <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100017>
-                       ;; and the similar adjustment in GCC-FINAL.
-                       (substitute* "libstdc++-v3/src/c++17/Makefile.in"
-                         (("AM_CXXFLAGS = ")
-                          (string-append ,(if (%current-target-system)
-                                              "CROSS_CPLUS_INCLUDE_PATH = "
-                                              "CPLUS_INCLUDE_PATH = ")
-                                         (string-join
-                                          (remove (cut string-prefix? gcc <>)
-                                                  (string-split
-                                                   (getenv
-                                                    ,(if (%current-target-system)
-                                                         "CROSS_CPLUS_INCLUDE_PATH"
-                                                         "CPLUS_INCLUDE_PATH"))
-                                                   #\:))
-                                          ":")
-                                         "\nAM_CXXFLAGS = ")))))))
-               '())
-         ,@(let ((version (package-version gcc)))
-                (if (and (target-ppc64le?)
-                    (version>=? version "11")
-                    (not (version>=? version "12")))
-               `((add-after 'unpack 'patch-powerpc
-                   (lambda* (#:key inputs #:allow-other-keys)
-                     (invoke "patch" "--force" "-p1" "-i"
-                             (assoc-ref inputs "powerpc64le-patch")))))
-               '()))
-         ;; Force rs6000 (i.e., powerpc) libdir to be /lib and not /lib64.
-         (add-before 'chdir 'fix-rs6000-libdir
-           (lambda _
-             (when (file-exists? "gcc/config/rs6000")
-               (substitute* (find-files "gcc/config/rs6000")
-                 (("/lib64") "/lib")))))
-         (add-before 'configure 'chdir
-           (lambda _
-             (chdir "libstdc++-v3"))))
-
-       #:configure-flags `("--disable-libstdcxx-pch"
+      #:phases
+      #~(modify-phases %standard-phases
+          #$@(if (version>=? (package-version gcc) "11")
+                 #~((add-after 'unpack 'hide-gcc-headers
+                      (lambda* (#:key native-inputs inputs #:allow-other-keys)
+                        (let ((gcc (assoc-ref (or native-inputs inputs)
+                                              #$(if (%current-target-system)
+                                                    "cross-gcc"
+                                                    "gcc"))))
+                          ;; Fix a regression in GCC 11 where the GCC headers
+                          ;; shadows glibc headers when building libstdc++.  An
+                          ;; upstream fix was added in GCC 11.3.0, but it only
+                          ;; hides system include directories, not those on
+                          ;; CPLUS_INCLUDE_PATH.  See discussion at
+                          ;; <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100017>
+                          ;; and the similar adjustment in GCC-FINAL.
+                          (substitute* "libstdc++-v3/src/c++17/Makefile.in"
+                            (("AM_CXXFLAGS = ")
+                             (string-append #$(if (%current-target-system)
+                                                  "CROSS_CPLUS_INCLUDE_PATH = "
+                                                  "CPLUS_INCLUDE_PATH = ")
+                                            (string-join
+                                             (remove (cut string-prefix? gcc <>)
+                                                     (string-split
+                                                      (getenv
+                                                       #$(if (%current-target-system)
+                                                             "CROSS_CPLUS_INCLUDE_PATH"
+                                                             "CPLUS_INCLUDE_PATH"))
+                                                      #\:))
+                                             ":")
+                                            "\nAM_CXXFLAGS = ")))))))
+                 '())
+          #$@(let ((version (package-version gcc)))
+               (if (and (target-ppc64le?)
+                       (version>=? version "11")
+                       (not (version>=? version "12")))
+                   #~((add-after 'unpack 'patch-powerpc
+                        (lambda* (#:key inputs #:allow-other-keys)
+                          (invoke "patch" "--force" "-p1" "-i"
+                                  (assoc-ref inputs "powerpc64le-patch")))))
+                   '()))
+          ;; Force rs6000 (i.e., powerpc) libdir to be /lib and not /lib64.
+          (add-before 'chdir 'fix-rs6000-libdir
+            (lambda _
+              (when (file-exists? "gcc/config/rs6000")
+                (substitute* (find-files "gcc/config/rs6000")
+                  (("/lib64") "/lib")))))
+          (add-before 'configure 'chdir
+            (lambda _
+              (chdir "libstdc++-v3"))))
+
+      #:configure-flags '`("--disable-libstdcxx-pch"
                            ,(string-append "--with-gxx-include-dir="
                                            (assoc-ref %outputs "out")
                                            "/include"))))

base-commit: 40d6615ca2755605e8aab790fbbae0221ec1d827
-- 
2.39.1





Information forwarded to guix-patches <at> gnu.org:
bug#63329; Package guix-patches. (Sat, 06 May 2023 21:33:01 GMT) Full text and rfc822 format available.

Message #8 received at 63329 <at> debbugs.gnu.org (full text, mbox):

From: Christopher Baines <mail <at> cbaines.net>
To: 63329 <at> debbugs.gnu.org
Subject: [PATCH v2] gnu: Use gexps for gcc-boot0 and related packages.
Date: Sat,  6 May 2023 22:32:30 +0100
There are currently problems with native or cross building for i586-gnu, and
one factor mixed up with this is that some of the gcc packages use sexp's for
the phases, and thus introducing gexp's has caused problems.

As part of the going in circles with this, this commit switches gcc-boot0 to
use gexp's in it's arguments, and then also modifies libstdc++-boot0,
libstdc++-boot0-gcc7, cross-gcc-wrapper, gcc-final and make-libstdc++ to
handle this change.

If done correctly, this change shouldn't affect any derivations.

* gnu/packages/commencement.scm (libstdc++-boot0, libstdc++-boot0-gcc7,
gcc-boot0, gcc-final)[arguments]: Use gexps.
(cross-gcc-wrapper): Use gexps in the generated package.
* gnu/packages/gcc.scm (make-libstdc++): Use gexps in the generated package.
---
 gnu/packages/commencement.scm | 421 +++++++++++++++++-----------------
 gnu/packages/gcc.scm          | 109 ++++-----
 2 files changed, 267 insertions(+), 263 deletions(-)

diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index fc1c508b38..c4b50ec2c4 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -2259,13 +2259,13 @@ (define libstdc++-boot0
              ((or "i686-linux" "x86_64-linux")
               (substitute-keyword-arguments (package-arguments lib)
                 ((#:phases phases)
-                 `(modify-phases ,phases
-                    (add-after 'unpack 'workaround-wrapper-bug
-                      ;; XXX: The crude gcc-cross-wrapper causes "g++ -v" to
-                      ;; fail, which in turn confuses the configure script.
-                      (lambda _
-                        (substitute* "libstdc++-v3/configure"
-                          (("g\\+\\+ -v") "true"))))))))
+                 #~(modify-phases #$phases
+                     (add-after 'unpack 'workaround-wrapper-bug
+                       ;; XXX: The crude gcc-cross-wrapper causes "g++ -v" to
+                       ;; fail, which in turn confuses the configure script.
+                       (lambda _
+                         (substitute* "libstdc++-v3/configure"
+                           (("g\\+\\+ -v") "true"))))))))
              (_ (package-arguments lib)))
 
          ;; Explicitly add #:modules so MAKE-LIBSTDC++ can be changed
@@ -2292,28 +2292,28 @@ (define libstdc++-boot0-gcc7
 
          ,@(substitute-keyword-arguments (package-arguments lib)
              ((#:phases phases)
-              `(modify-phases ,phases
-                 (add-after 'unpack 'unpack-gmp&co
-                   (lambda* (#:key inputs #:allow-other-keys)
-                     (let ((gmp  (assoc-ref %build-inputs "gmp-source"))
-                           (mpfr (assoc-ref %build-inputs "mpfr-source"))
-                           (mpc  (assoc-ref %build-inputs "mpc-source")))
-
-                       ;; To reduce the set of pre-built bootstrap inputs, build
-                       ;; GMP & co. from GCC.
-                       (for-each (lambda (source)
-                                   (invoke "tar" "xvf" source))
-                                 (list gmp mpfr mpc))
-
-                       ;; Create symlinks like `gmp' -> `gmp-x.y.z'.
-                       ,@(map (lambda (lib)
-                                ;; Drop trailing letters, as gmp-6.0.0a unpacks
-                                ;; into gmp-6.0.0.
-                                `(symlink ,(string-trim-right
-                                            (package-full-name lib "-")
-                                            char-set:letter)
-                                          ,(package-name lib)))
-                              (list gmp-6.0 mpfr mpc))))))))))
+              #~(modify-phases #$phases
+                  (add-after 'unpack 'unpack-gmp&co
+                    (lambda* (#:key inputs #:allow-other-keys)
+                      (let ((gmp  (assoc-ref %build-inputs "gmp-source"))
+                            (mpfr (assoc-ref %build-inputs "mpfr-source"))
+                            (mpc  (assoc-ref %build-inputs "mpc-source")))
+
+                        ;; To reduce the set of pre-built bootstrap inputs, build
+                        ;; GMP & co. from GCC.
+                        (for-each (lambda (source)
+                                    (invoke "tar" "xvf" source))
+                                  (list gmp mpfr mpc))
+
+                        ;; Create symlinks like `gmp' -> `gmp-x.y.z'.
+                        #$@(map (lambda (lib)
+                                  ;; Drop trailing letters, as gmp-6.0.0a unpacks
+                                  ;; into gmp-6.0.0.
+                                  #~(symlink #$(string-trim-right
+                                                (package-full-name lib "-")
+                                                char-set:letter)
+                                             #$(package-name lib)))
+                                (list gmp-6.0 mpfr mpc))))))))))
       (inputs `(("gmp-source" ,(bootstrap-origin (package-source gmp-6.0)))
                 ("mpfr-source" ,(bootstrap-origin (package-source mpfr)))
                 ("mpc-source" ,(bootstrap-origin (package-source mpc)))
@@ -2338,81 +2338,82 @@ (define gcc-boot0
              (system* #$(file-append coreutils-boot0 "/bin/rm") "-rf"
                       "gcc/testsuite/go.test/test/fixedbugs/issue27836.dir"))))))
     (arguments
-     `(#:guile ,%bootstrap-guile
-       #:implicit-inputs? #f
-       #:modules ((guix build gnu-build-system)
+     (cons*
+      #:guile %bootstrap-guile
+      #:implicit-inputs? #f
+      #:modules '((guix build gnu-build-system)
                   (guix build utils)
                   (ice-9 regex)
                   (srfi srfi-1)
                   (srfi srfi-26))
-       ,@(substitute-keyword-arguments (package-arguments gcc)
-           ((#:configure-flags flags)
-            `(append (list ,(string-append "--target=" (boot-triplet))
-
-                           ;; No libc yet.
-                           "--without-headers"
-
-                           ;; Disable features not needed at this stage.
-                           "--disable-shared"
-                           "--enable-languages=c,c++"
-
-                           ;; libstdc++ cannot be built at this stage
-                           ;; ("Link tests are not allowed after
-                           ;; GCC_NO_EXECUTABLES.").
-                           "--disable-libstdc++-v3"
-
-                           "--disable-threads"
-                           "--disable-libmudflap"
-                           "--disable-libatomic"
-                           "--disable-libsanitizer"
-                           "--disable-libitm"
-                           "--disable-libgomp"
-                           "--disable-libmpx"
-                           "--disable-libcilkrts"
-                           "--disable-libvtv"
-                           "--disable-libssp"
-                           "--disable-libquadmath"
-                           "--disable-decimal-float")
-                     (remove (cut string-match
-                               "--(with-system-zlib|enable-languages.*)" <>)
-                             ,flags)))
-           ((#:make-flags flags)
-            `(let* ((libc        (assoc-ref %build-inputs "libc"))
-                    (libc-native (or (assoc-ref %build-inputs "libc-native")
-                                     libc)))
-               `(,(string-append "LDFLAGS="
-                                 "-Wl,-rpath=" libc-native "/lib "
-                                 "-Wl,-dynamic-linker "
-                                 "-Wl," libc-native ,(glibc-dynamic-linker
-                                                      (match (%current-system)
-                                                        ("x86_64-linux" "i686-linux")
-                                                        (_ (%current-system))))))))
-           ((#:phases phases)
-            `(modify-phases ,phases
-               (add-after 'unpack 'unpack-gmp&co
-                 (lambda* (#:key inputs #:allow-other-keys)
-                   (let ((gmp  (assoc-ref %build-inputs "gmp-source"))
-                         (mpfr (assoc-ref %build-inputs "mpfr-source"))
-                         (mpc  (assoc-ref %build-inputs "mpc-source")))
-
-                     ;; To reduce the set of pre-built bootstrap inputs, build
-                     ;; GMP & co. from GCC.
-                     (for-each (lambda (source)
-                                 (invoke "tar" "xvf" source))
-                               (list gmp mpfr mpc))
-
-                     ;; Create symlinks like `gmp' -> `gmp-x.y.z'.
-                     ,@(map (lambda (lib)
-                              ;; Drop trailing letters, as gmp-6.0.0a unpacks
-                              ;; into gmp-6.0.0.
-                              `(symlink ,(string-trim-right
-                                          (package-full-name lib "-")
-                                          char-set:letter)
-                                        ,(package-name lib)))
-                            (list gmp-6.0 mpfr mpc)))))
-               ,(match (%current-system)
-                  ((or "i686-linux" "x86_64-linux")
-                   '(add-before 'configure 'fix-libcc1
+      (substitute-keyword-arguments (package-arguments gcc)
+        ((#:configure-flags flags)
+         #~(append (list #$(string-append "--target=" (boot-triplet))
+
+                         ;; No libc yet.
+                         "--without-headers"
+
+                         ;; Disable features not needed at this stage.
+                         "--disable-shared"
+                         "--enable-languages=c,c++"
+
+                         ;; libstdc++ cannot be built at this stage
+                         ;; ("Link tests are not allowed after
+                         ;; GCC_NO_EXECUTABLES.").
+                         "--disable-libstdc++-v3"
+
+                         "--disable-threads"
+                         "--disable-libmudflap"
+                         "--disable-libatomic"
+                         "--disable-libsanitizer"
+                         "--disable-libitm"
+                         "--disable-libgomp"
+                         "--disable-libmpx"
+                         "--disable-libcilkrts"
+                         "--disable-libvtv"
+                         "--disable-libssp"
+                         "--disable-libquadmath"
+                         "--disable-decimal-float")
+                   (remove (cut string-match
+                                "--(with-system-zlib|enable-languages.*)" <>)
+                           #$flags)))
+        ((#:make-flags flags)
+         `(let* ((libc        (assoc-ref %build-inputs "libc"))
+                 (libc-native (or (assoc-ref %build-inputs "libc-native")
+                                  libc)))
+            `(,(string-append "LDFLAGS="
+                              "-Wl,-rpath=" libc-native "/lib "
+                              "-Wl,-dynamic-linker "
+                              "-Wl," libc-native ,(glibc-dynamic-linker
+                                                   (match (%current-system)
+                                                     ("x86_64-linux" "i686-linux")
+                                                     (_ (%current-system))))))))
+        ((#:phases phases)
+         #~(modify-phases #$phases
+             (add-after 'unpack 'unpack-gmp&co
+               (lambda* (#:key inputs #:allow-other-keys)
+                 (let ((gmp  (assoc-ref %build-inputs "gmp-source"))
+                       (mpfr (assoc-ref %build-inputs "mpfr-source"))
+                       (mpc  (assoc-ref %build-inputs "mpc-source")))
+
+                   ;; To reduce the set of pre-built bootstrap inputs, build
+                   ;; GMP & co. from GCC.
+                   (for-each (lambda (source)
+                               (invoke "tar" "xvf" source))
+                             (list gmp mpfr mpc))
+
+                   ;; Create symlinks like `gmp' -> `gmp-x.y.z'.
+                   #$@(map (lambda (lib)
+                             ;; Drop trailing letters, as gmp-6.0.0a unpacks
+                             ;; into gmp-6.0.0.
+                             #~(symlink #$(string-trim-right
+                                           (package-full-name lib "-")
+                                           char-set:letter)
+                                        #$(package-name lib)))
+                           (list gmp-6.0 mpfr mpc)))))
+             #$(match (%current-system)
+                 ((or "i686-linux" "x86_64-linux")
+                  #~(add-before 'configure 'fix-libcc1
                       (lambda* (#:key inputs #:allow-other-keys)
                         ;; libcc1.so NEEDs libgcc_s.so, so provide one here
                         ;; to placate the 'validate-runpath' phase.
@@ -2423,18 +2424,18 @@ (define gcc-boot0
                         ;; XXX: "g++ -v" is broken (see also libstdc++ above).
                         (substitute* "libcc1/configure"
                           (("g\\+\\+ -v") "true")))))
-                  (_ '(add-before 'configure 'return-true
+                 (_ #~(add-before 'configure 'return-true
                         (lambda _ #t))))
-               (add-after 'install 'symlink-libgcc_eh
-                 (lambda* (#:key outputs #:allow-other-keys)
-                   (let ((out (assoc-ref outputs "lib")))
-                     ;; Glibc wants to link against libgcc_eh, so provide
-                     ;; it.
-                     (with-directory-excursion
-                         (string-append out "/lib/gcc/"
-                                        ,(boot-triplet)
-                                        "/" ,(package-version gcc))
-                       (symlink "libgcc.a" "libgcc_eh.a"))))))))))
+             (add-after 'install 'symlink-libgcc_eh
+               (lambda* (#:key outputs #:allow-other-keys)
+                 (let ((out (assoc-ref outputs "lib")))
+                   ;; Glibc wants to link against libgcc_eh, so provide
+                   ;; it.
+                   (with-directory-excursion
+                       (string-append out "/lib/gcc/"
+                                      #$(boot-triplet)
+                                      "/" #$(package-version gcc))
+                     (symlink "libgcc.a" "libgcc_eh.a"))))))))))
 
     (inputs `(("gmp-source" ,(bootstrap-origin (package-source gmp-6.0)))
               ("mpfr-source" ,(bootstrap-origin (package-source mpfr)))
@@ -2888,41 +2889,42 @@ (define (cross-gcc-wrapper gcc binutils glibc bash)
     (build-system trivial-build-system)
     (outputs '("out"))
     (arguments
-     `(#:guile ,%bootstrap-guile
-       #:modules ((guix build utils))
-       #:builder (begin
-                   (use-modules (guix build utils))
-
-                   (let* ((binutils (assoc-ref %build-inputs "binutils"))
-                          (gcc      (assoc-ref %build-inputs "gcc"))
-                          (libc     (assoc-ref %build-inputs "libc"))
-                          (bash     (assoc-ref %build-inputs "bash"))
-                          (out      (assoc-ref %outputs "out"))
-                          (bindir   (string-append out "/bin"))
-                          (triplet  ,(boot-triplet)))
-                     (define (wrap-program program)
-                       ;; GCC-BOOT0 is a libc-less cross-compiler, so it
-                       ;; needs to be told where to find the crt files and
-                       ;; the dynamic linker.
-                       (call-with-output-file program
-                         (lambda (p)
-                           (format p "#!~a/bin/bash
+     (list
+      #:guile %bootstrap-guile
+      #:modules '((guix build utils))
+      #:builder #~(begin
+                    (use-modules (guix build utils))
+
+                    (let* ((binutils (assoc-ref %build-inputs "binutils"))
+                           (gcc      (assoc-ref %build-inputs "gcc"))
+                           (libc     (assoc-ref %build-inputs "libc"))
+                           (bash     (assoc-ref %build-inputs "bash"))
+                           (out      (assoc-ref %outputs "out"))
+                           (bindir   (string-append out "/bin"))
+                           (triplet  #$(boot-triplet)))
+                      (define (wrap-program program)
+                        ;; GCC-BOOT0 is a libc-less cross-compiler, so it
+                        ;; needs to be told where to find the crt files and
+                        ;; the dynamic linker.
+                        (call-with-output-file program
+                          (lambda (p)
+                            (format p "#!~a/bin/bash
 exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker -Wl,~a/~a \"$@\"~%"
-                                   bash
-                                   gcc triplet program
-                                   libc libc
-                                   ,(glibc-dynamic-linker))))
-
-                       (chmod program #o555))
-
-                     (mkdir-p bindir)
-                     (with-directory-excursion bindir
-                       (for-each (lambda (tool)
-                                   (symlink (string-append binutils "/bin/"
-                                                           triplet "-" tool)
-                                            tool))
-                                 '("ar" "ranlib"))
-                       (for-each wrap-program '("gcc" "g++")))))))
+                                    bash
+                                    gcc triplet program
+                                    libc libc
+                                    #$(glibc-dynamic-linker))))
+
+                        (chmod program #o555))
+
+                      (mkdir-p bindir)
+                      (with-directory-excursion bindir
+                        (for-each (lambda (tool)
+                                    (symlink (string-append binutils "/bin/"
+                                                            triplet "-" tool)
+                                             tool))
+                                  '("ar" "ranlib"))
+                        (for-each wrap-program '("gcc" "g++")))))))
     (native-inputs
      `(("binutils" ,binutils)
        ("gcc" ,gcc)
@@ -3122,79 +3124,80 @@ (define gcc-final
     (outputs (delete "debug" (package-outputs gcc-boot0)))
 
     (arguments
-     `(#:guile ,%bootstrap-guile
-       #:implicit-inputs? #f
+     (cons*
+      #:guile %bootstrap-guile
+      #:implicit-inputs? #f
 
-       #:allowed-references ("out" "lib" ,zlib-final
+      #:allowed-references `("out" "lib" ,zlib-final
                              ,glibc-final ,static-bash-for-glibc)
 
-       ;; Things like libasan.so and libstdc++.so NEED ld.so for some
-       ;; reason, but it is not in their RUNPATH.  This is a false
-       ;; positive, so turn it off.
-       #:validate-runpath? #f
+      ;; Things like libasan.so and libstdc++.so NEED ld.so for some
+      ;; reason, but it is not in their RUNPATH.  This is a false
+      ;; positive, so turn it off.
+      #:validate-runpath? #f
 
-       ;; Additional modules for the libstdc++ phase below.
-       #:modules ((srfi srfi-1)
+      ;; Additional modules for the libstdc++ phase below.
+      #:modules `((srfi srfi-1)
                   (srfi srfi-26)
                   ,@%gnu-build-system-modules)
 
-       ,@(substitute-keyword-arguments (package-arguments gcc)
-           ((#:make-flags flags)
-            ;; Since $LIBRARY_PATH is not honored, add the relevant flags.
-            `(let ((zlib (assoc-ref %build-inputs "zlib")))
-               (map (lambda (flag)
-                      (if (string-prefix? "LDFLAGS=" flag)
-                          (string-append flag " -L"
-                                         (assoc-ref %build-inputs "libstdc++")
-                                         "/lib -L" zlib "/lib -Wl,-rpath="
-                                         zlib "/lib")
-                          flag))
-                    ,flags)))
-           ;; Build again GMP & co. within GCC's build process, because it's hard
-           ;; to do outside (because GCC-BOOT0 is a cross-compiler, and thus
-           ;; doesn't honor $LIBRARY_PATH, which breaks `gnu-build-system'.)
-           ((#:phases phases)
-            `(modify-phases ,phases
-                (add-after 'unpack 'unpack-gmp&co
-                  (lambda* (#:key inputs #:allow-other-keys)
-                    (let ((gmp  (assoc-ref %build-inputs "gmp-source"))
-                          (mpfr (assoc-ref %build-inputs "mpfr-source"))
-                          (mpc  (assoc-ref %build-inputs "mpc-source")))
-
-                      ;; To reduce the set of pre-built bootstrap inputs, build
-                      ;; GMP & co. from GCC.
-                      (for-each (lambda (source)
-                                  (invoke "tar" "xvf" source))
-                                (list gmp mpfr mpc))
-
-                      ;; Create symlinks like `gmp' -> `gmp-x.y.z'.
-                      ,@(map (lambda (lib)
-                               ;; Drop trailing letters, as gmp-6.0.0a unpacks
-                               ;; into gmp-6.0.0.
-                               `(symlink ,(string-trim-right
+      (substitute-keyword-arguments (package-arguments gcc)
+        ((#:make-flags flags)
+         ;; Since $LIBRARY_PATH is not honored, add the relevant flags.
+         #~(let ((zlib (assoc-ref %build-inputs "zlib")))
+             (map (lambda (flag)
+                    (if (string-prefix? "LDFLAGS=" flag)
+                        (string-append flag " -L"
+                                       (assoc-ref %build-inputs "libstdc++")
+                                       "/lib -L" zlib "/lib -Wl,-rpath="
+                                       zlib "/lib")
+                        flag))
+                  #$flags)))
+        ;; Build again GMP & co. within GCC's build process, because it's hard
+        ;; to do outside (because GCC-BOOT0 is a cross-compiler, and thus
+        ;; doesn't honor $LIBRARY_PATH, which breaks `gnu-build-system'.)
+        ((#:phases phases)
+         #~(modify-phases #$phases
+             (add-after 'unpack 'unpack-gmp&co
+               (lambda* (#:key inputs #:allow-other-keys)
+                 (let ((gmp  (assoc-ref %build-inputs "gmp-source"))
+                       (mpfr (assoc-ref %build-inputs "mpfr-source"))
+                       (mpc  (assoc-ref %build-inputs "mpc-source")))
+
+                   ;; To reduce the set of pre-built bootstrap inputs, build
+                   ;; GMP & co. from GCC.
+                   (for-each (lambda (source)
+                               (invoke "tar" "xvf" source))
+                             (list gmp mpfr mpc))
+
+                   ;; Create symlinks like `gmp' -> `gmp-x.y.z'.
+                   #$@(map (lambda (lib)
+                             ;; Drop trailing letters, as gmp-6.0.0a unpacks
+                             ;; into gmp-6.0.0.
+                             #~(symlink #$(string-trim-right
                                            (package-full-name lib "-")
                                            char-set:letter)
-                                         ,(package-name lib)))
-                             (list gmp-6.0 mpfr mpc)))))
-                (add-after 'unpack 'fix-build-with-external-libstdc++
-                  (lambda* (#:key inputs #:allow-other-keys)
-                    (let ((libstdc++ (assoc-ref inputs "libstdc++")))
-                      ;; Fix a regression in GCC 11 where the libstc++ input
-                      ;; shadows glibc headers when building libstdc++.  An
-                      ;; upstream fix was added in GCC 11.3.0, but it only
-                      ;; hides system include directories, not those on
-                      ;; CPLUS_INCLUDE_PATH.  See discussion at
-                      ;; <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100017>.
-                      (substitute* "libstdc++-v3/src/c++17/Makefile.in"
-                        (("AM_CXXFLAGS = ")
-                         (string-append "CPLUS_INCLUDE_PATH = "
-                                        (string-join
-                                         (remove (cut string-prefix? libstdc++ <>)
-                                                 (string-split
-                                                  (getenv "CPLUS_INCLUDE_PATH")
-                                                  #\:))
-                                         ":")
-                                        "\nAM_CXXFLAGS = ")))))))))))
+                                        #$(package-name lib)))
+                           (list gmp-6.0 mpfr mpc)))))
+             (add-after 'unpack 'fix-build-with-external-libstdc++
+               (lambda* (#:key inputs #:allow-other-keys)
+                 (let ((libstdc++ (assoc-ref inputs "libstdc++")))
+                   ;; Fix a regression in GCC 11 where the libstc++ input
+                   ;; shadows glibc headers when building libstdc++.  An
+                   ;; upstream fix was added in GCC 11.3.0, but it only
+                   ;; hides system include directories, not those on
+                   ;; CPLUS_INCLUDE_PATH.  See discussion at
+                   ;; <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100017>.
+                   (substitute* "libstdc++-v3/src/c++17/Makefile.in"
+                     (("AM_CXXFLAGS = ")
+                      (string-append "CPLUS_INCLUDE_PATH = "
+                                     (string-join
+                                      (remove (cut string-prefix? libstdc++ <>)
+                                              (string-split
+                                               (getenv "CPLUS_INCLUDE_PATH")
+                                               #\:))
+                                      ":")
+                                     "\nAM_CXXFLAGS = ")))))))))))
 
     ;; This time we want Texinfo, so we get the manual.  Add
     ;; STATIC-BASH-FOR-GLIBC so that it's used in the final shebangs of
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index fade5bb64b..d1c79b8dc2 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -864,62 +864,63 @@ (define-public (make-libstdc++ gcc)
     (inherit gcc)
     (name "libstdc++")
     (arguments
-     `(#:out-of-source? #t
-       #:modules ((srfi srfi-1)
+     (list
+      #:out-of-source? #t
+      #:modules `((srfi srfi-1)
                   (srfi srfi-26)
                   ,@%gnu-build-system-modules)
-       #:phases
-       (modify-phases %standard-phases
-         ,@(if (version>=? (package-version gcc) "11")
-               `((add-after 'unpack 'hide-gcc-headers
-                   (lambda* (#:key native-inputs inputs #:allow-other-keys)
-                     (let ((gcc (assoc-ref (or native-inputs inputs)
-                                           ,(if (%current-target-system)
-                                                "cross-gcc"
-                                                "gcc"))))
-                       ;; Fix a regression in GCC 11 where the GCC headers
-                       ;; shadows glibc headers when building libstdc++.  An
-                       ;; upstream fix was added in GCC 11.3.0, but it only
-                       ;; hides system include directories, not those on
-                       ;; CPLUS_INCLUDE_PATH.  See discussion at
-                       ;; <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100017>
-                       ;; and the similar adjustment in GCC-FINAL.
-                       (substitute* "libstdc++-v3/src/c++17/Makefile.in"
-                         (("AM_CXXFLAGS = ")
-                          (string-append ,(if (%current-target-system)
-                                              "CROSS_CPLUS_INCLUDE_PATH = "
-                                              "CPLUS_INCLUDE_PATH = ")
-                                         (string-join
-                                          (remove (cut string-prefix? gcc <>)
-                                                  (string-split
-                                                   (getenv
-                                                    ,(if (%current-target-system)
-                                                         "CROSS_CPLUS_INCLUDE_PATH"
-                                                         "CPLUS_INCLUDE_PATH"))
-                                                   #\:))
-                                          ":")
-                                         "\nAM_CXXFLAGS = ")))))))
-               '())
-         ,@(let ((version (package-version gcc)))
-                (if (and (target-ppc64le?)
-                    (version>=? version "11")
-                    (not (version>=? version "12")))
-               `((add-after 'unpack 'patch-powerpc
-                   (lambda* (#:key inputs #:allow-other-keys)
-                     (invoke "patch" "--force" "-p1" "-i"
-                             (assoc-ref inputs "powerpc64le-patch")))))
-               '()))
-         ;; Force rs6000 (i.e., powerpc) libdir to be /lib and not /lib64.
-         (add-before 'chdir 'fix-rs6000-libdir
-           (lambda _
-             (when (file-exists? "gcc/config/rs6000")
-               (substitute* (find-files "gcc/config/rs6000")
-                 (("/lib64") "/lib")))))
-         (add-before 'configure 'chdir
-           (lambda _
-             (chdir "libstdc++-v3"))))
-
-       #:configure-flags `("--disable-libstdcxx-pch"
+      #:phases
+      #~(modify-phases %standard-phases
+          #$@(if (version>=? (package-version gcc) "11")
+                 #~((add-after 'unpack 'hide-gcc-headers
+                      (lambda* (#:key native-inputs inputs #:allow-other-keys)
+                        (let ((gcc (assoc-ref (or native-inputs inputs)
+                                              #$(if (%current-target-system)
+                                                    "cross-gcc"
+                                                    "gcc"))))
+                          ;; Fix a regression in GCC 11 where the GCC headers
+                          ;; shadows glibc headers when building libstdc++.  An
+                          ;; upstream fix was added in GCC 11.3.0, but it only
+                          ;; hides system include directories, not those on
+                          ;; CPLUS_INCLUDE_PATH.  See discussion at
+                          ;; <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100017>
+                          ;; and the similar adjustment in GCC-FINAL.
+                          (substitute* "libstdc++-v3/src/c++17/Makefile.in"
+                            (("AM_CXXFLAGS = ")
+                             (string-append #$(if (%current-target-system)
+                                                  "CROSS_CPLUS_INCLUDE_PATH = "
+                                                  "CPLUS_INCLUDE_PATH = ")
+                                            (string-join
+                                             (remove (cut string-prefix? gcc <>)
+                                                     (string-split
+                                                      (getenv
+                                                       #$(if (%current-target-system)
+                                                             "CROSS_CPLUS_INCLUDE_PATH"
+                                                             "CPLUS_INCLUDE_PATH"))
+                                                      #\:))
+                                             ":")
+                                            "\nAM_CXXFLAGS = ")))))))
+                 '())
+          #$@(let ((version (package-version gcc)))
+               (if (and (target-ppc64le?)
+                       (version>=? version "11")
+                       (not (version>=? version "12")))
+                   #~((add-after 'unpack 'patch-powerpc
+                        (lambda* (#:key inputs #:allow-other-keys)
+                          (invoke "patch" "--force" "-p1" "-i"
+                                  (assoc-ref inputs "powerpc64le-patch")))))
+                   '()))
+          ;; Force rs6000 (i.e., powerpc) libdir to be /lib and not /lib64.
+          (add-before 'chdir 'fix-rs6000-libdir
+            (lambda _
+              (when (file-exists? "gcc/config/rs6000")
+                (substitute* (find-files "gcc/config/rs6000")
+                  (("/lib64") "/lib")))))
+          (add-before 'configure 'chdir
+            (lambda _
+              (chdir "libstdc++-v3"))))
+
+      #:configure-flags '`("--disable-libstdcxx-pch"
                            ,(string-append "--with-gxx-include-dir="
                                            (assoc-ref %outputs "out")
                                            "/include"))))

base-commit: 40d6615ca2755605e8aab790fbbae0221ec1d827
-- 
2.39.1





Reply sent to Christopher Baines <mail <at> cbaines.net>:
You have taken responsibility. (Sun, 07 May 2023 08:42:02 GMT) Full text and rfc822 format available.

Notification sent to Christopher Baines <mail <at> cbaines.net>:
bug acknowledged by developer. (Sun, 07 May 2023 08:42:02 GMT) Full text and rfc822 format available.

Message #13 received at 63329-done <at> debbugs.gnu.org (full text, mbox):

From: Christopher Baines <mail <at> cbaines.net>
To: 63329-done <at> debbugs.gnu.org
Subject: Re: [bug#63329] [PATCH v2] gnu: Use gexps for gcc-boot0 and related
 packages.
Date: Sun, 07 May 2023 09:39:09 +0100
[Message part 1 (text/plain, inline)]
Christopher Baines <mail <at> cbaines.net> writes:

> There are currently problems with native or cross building for i586-gnu, and
> one factor mixed up with this is that some of the gcc packages use sexp's for
> the phases, and thus introducing gexp's has caused problems.
>
> As part of the going in circles with this, this commit switches gcc-boot0 to
> use gexp's in it's arguments, and then also modifies libstdc++-boot0,
> libstdc++-boot0-gcc7, cross-gcc-wrapper, gcc-final and make-libstdc++ to
> handle this change.
>
> If done correctly, this change shouldn't affect any derivations.
>
> * gnu/packages/commencement.scm (libstdc++-boot0, libstdc++-boot0-gcc7,
> gcc-boot0, gcc-final)[arguments]: Use gexps.
> (cross-gcc-wrapper): Use gexps in the generated package.
> * gnu/packages/gcc.scm (make-libstdc++): Use gexps in the generated package.
> ---
>  gnu/packages/commencement.scm | 421 +++++++++++++++++-----------------
>  gnu/packages/gcc.scm          | 109 ++++-----
>  2 files changed, 267 insertions(+), 263 deletions(-)

The data service didn't show any changes in derivations associated with
this change, so I've gone ahead and pushed it to master as
a795a02a9d988be5a762886620f7bb6a95e7ffdb.

It did show some changes, but they related to gexp's in the builder
script for icu4c-70 when built for riscv64. I fixed that in
b1e9ae7f0e72bc3c8c7ab28362315fac5dfb65fe.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#63329; Package guix-patches. (Sun, 07 May 2023 21:28:02 GMT) Full text and rfc822 format available.

Message #16 received at 63329 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Christopher Baines <mail <at> cbaines.net>
Cc: 63329 <at> debbugs.gnu.org
Subject: Re: bug#63329: [PATCH] gnu: Use gexps for gcc-boot0 and related
 packages.
Date: Sun, 07 May 2023 23:27:33 +0200
Hi,

Christopher Baines <mail <at> cbaines.net> skribis:

> There are currently problems with native or cross building for i586-gnu, and
> one factor mixed up with this is that some of the gcc packages use sexp's for
> the phases, and thus introducing gexp's has caused problems.
>
> As part of the going in circles with this, this commit switches gcc-boot0 to
> use gexp's in it's arguments, and then also modifies libstdc++-boot0,
> libstdc++-boot0-gcc7, cross-gcc-wrapper, gcc-final and make-libstdc++ to
> handle this change.
>
> If done correctly, this change shouldn't affect any derivations.
>
> * gnu/packages/commencement.scm (libstdc++-boot0, libstdc++-boot0-gcc7,
> gcc-boot0, gcc-final)[arguments]: Use gexps.
> (cross-gcc-wrapper): Use gexps in the generated package.
> * gnu/packages/gcc.scm (make-libstdc++): Use gexps in the generated package.

I’m late to the party, but I think it goes in the right direction.
Thank you!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 05 Jun 2023 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 323 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.