janneke pushed a commit to branch core-packages-team
in repository guix.

commit 414eeafad50da28108bb2accfc3e099347558533
Author: Janneke Nieuwenhuizen <[email protected]>
AuthorDate: Sun Dec 15 22:41:51 2024 +0100

    gnu: gcc: Fix build with gcc-14.
    
    This avoids
    
        libstdc++-v3/src/c++98/compatibility.cc:392:4: error: ‘void 
{anonymous}::_Y_ZNSt13basic_istreamIwSt11char_traitsIwEE6ignoreEi(...)’ aliased 
to undefined symbol ‘_ZNSt13basic_istreamIwSt11char_traitsIwEE8ignoreXXEi’
          392 |    _Y##name(...) \
              |    ^~
        ../../../../gcc-11.4.0/libstdc++-v3/src/c++98/compatibility.cc:403:31: 
note: in expansion of macro ‘_GLIBCXX_3_4_5_SYMVER’
          403 | #define _GLIBCXX_APPLY_SYMVER _GLIBCXX_3_4_5_SYMVER
              |                               ^~~~~~~~~~~~~~~~~~~~~
       .../include/x86_64-unknown-linux-gnu/bits/compatibility.h:196:1: note: 
in expansion of macro ‘_GLIBCXX_APPLY_SYMVER’
          196 | 
_GLIBCXX_APPLY_SYMVER(_ZNSt13basic_istreamIwSt11char_traitsIwEE8ignoreXXEi,
              | ^~~~~~~~~~~~~~~
    
    for (at least 5.5 <= gcc  < 14.2
    
    gcc-4.7 still fails earlier, with
    
        ./md-unwind-support.h:60:47: error: dereferencing pointer to incomplete 
type
    =>
         libgcc/config/i386/linux-unwind.h
         60:  sc = (struct sigcontext *) (void *) &uc_->uc_mcontext;
    
    * gnu/packages/patches/gcc-build-with-gcc-14.patch: New file.
    * gnu/local.mk (dist_patch_DATA): Register it.
    * gnu/packages/gcc.scm (gcc-4.7, gcc-4.8, gcc-4.9, gcc-5, gcc-6, gcc-7, 
gcc-8,
    gcc-9, gcc-10, gcc-11, gcc-12, gcc-13): Use it.
    (gcc-4.7)[arguments]: In stage "relax-gcc-14s-strictness", make wrapper 
relax
    gcc-14's strictness further, for (at least) 8 < gcc < 14.
    
    Change-Id: I57b0ab94e733ab9eb2ad226b5fcbc951860a48c3
---
 gnu/local.mk                                     |  1 +
 gnu/packages/gcc.scm                             | 42 +++++++++++++-------
 gnu/packages/patches/gcc-build-with-gcc-14.patch | 50 ++++++++++++++++++++++++
 3 files changed, 79 insertions(+), 14 deletions(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index 55cd6f42c6..d95490ceb3 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1326,6 +1326,7 @@ dist_patch_DATA =                                         
\
   %D%/packages/patches/gcc-cross-environment-variables.patch   \
   %D%/packages/patches/gcc-cross-gxx-include-dir.patch          \
   %D%/packages/patches/gcc-fix-texi2pod.patch                  \
+  %D%/packages/patches/gcc-build-with-gcc-14.patch             \
   %D%/packages/patches/gcc-4.8-libsanitizer-fix.patch          \
   %D%/packages/patches/gcc-4.9-inline.patch            \
   %D%/packages/patches/gcc-4.9-libsanitizer-fix.patch          \
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index 35e8264822..ab6237403d 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -177,7 +177,8 @@ where the OS part is overloaded to denote a specific 
ABI---into GCC
                   (base32
                    "10k2k71kxgay283ylbbhhs51cl55zn2q38vj5pk4k950qdnirrlj"))
                  (patches (search-patches "gcc-4-compile-with-gcc-5.patch"
-                                          "gcc-fix-texi2pod.patch"))))
+                                          "gcc-fix-texi2pod.patch"
+                                          "gcc-build-with-gcc-14.patch"))))
        (build-system gnu-build-system)
 
        ;; Separate out the run-time support libraries because all the
@@ -248,7 +249,8 @@ where the OS part is overloaded to denote a specific 
ABI---into GCC
                       (format #t "#! ~a/bin/bash
 exec gcc \"$@\" \
     -Wno-error \
-    -Wno-error=implicit-function-declaration"
+    -Wno-error=implicit-function-declaration
+    -Wno-error=incompatible-pointer-types"
                               bash)))
                   (chmod wrapper #o555)
                   (with-output-to-file stage-wrapper
@@ -256,7 +258,8 @@ exec gcc \"$@\" \
                       (format #t "#! ~a/bin/bash
 exec \"$@\" \
     -Wno-error \
-    -Wno-error=implicit-function-declaration"
+    -Wno-error=implicit-function-declaration
+    -Wno-error=incompatible-pointer-types"
                               bash)))
                   (chmod stage-wrapper #o555)
                   ;; Rather than adding CC to #:configure-flags and
@@ -426,7 +429,8 @@ Go.  It also includes runtime support libraries for these 
languages.")
               (patches (search-patches "gcc-arm-link-spec-fix.patch"
                                        "gcc-4.8-libsanitizer-fix.patch"
                                        "gcc-asan-missing-include.patch"
-                                       "gcc-fix-texi2pod.patch"))
+                                       "gcc-fix-texi2pod.patch"
+                                       "gcc-build-with-gcc-14.patch"))
               (modules '((guix build utils)))
               ;; This is required for building with glibc-2.26.
               ;; https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81712
@@ -490,7 +494,8 @@ Go.  It also includes runtime support libraries for these 
languages.")
                                        "gcc-arm-bug-71399.patch"
                                        "gcc-asan-missing-include.patch"
                                        "gcc-libvtv-runpath.patch"
-                                       "gcc-fix-texi2pod.patch"))
+                                       "gcc-fix-texi2pod.patch"
+                                       "gcc-build-with-gcc-14.patch"))
               (modules '((guix build utils)))
               ;; This is required for building with glibc-2.26.
               ;; https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81712
@@ -543,7 +548,8 @@ Go.  It also includes runtime support libraries for these 
languages.")
                                        "gcc-fix-texi2pod.patch"
                                        "gcc-5-hurd.patch"
                                        ;; See 
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86162
-                                       "gcc-5-fix-powerpc64le-build.patch"))
+                                       "gcc-5-fix-powerpc64le-build.patch"
+                                       "gcc-build-with-gcc-14.patch"))
               (modules '((guix build utils)))
               (snippet gcc-canadian-cross-objdump-snippet)))
     (inputs
@@ -567,7 +573,8 @@ Go.  It also includes runtime support libraries for these 
languages.")
                                        "gcc-6-libsanitizer-mode-size.patch"
                                        "gcc-6-source-date-epoch-1.patch"
                                        "gcc-6-source-date-epoch-2.patch"
-                                       "gcc-5.0-libvtv-runpath.patch"))))
+                                       "gcc-5.0-libvtv-runpath.patch"
+                                       "gcc-build-with-gcc-14.patch"))))
 
     ;; GCC 4.9 and 5 has a workaround that is not needed for GCC 6 and later.
     (arguments (package-arguments gcc-4.7))
@@ -692,7 +699,8 @@ Go.  It also includes runtime support libraries for these 
languages.")
               (patches (search-patches "gcc-strmov-store-file-names.patch"
                                        "gcc-7-libsanitizer-mode-size.patch"
                                        
"gcc-7-libsanitizer-fsconfig-command.patch"
-                                       "gcc-5.0-libvtv-runpath.patch"))))
+                                       "gcc-5.0-libvtv-runpath.patch"
+                                       "gcc-build-with-gcc-14.patch"))))
     (description
      "GCC is the GNU Compiler Collection.  It provides compiler front-ends
 for several languages, including C, C++, Objective-C, Fortran, Ada, and Go.
@@ -719,7 +727,8 @@ It also includes runtime support libraries for these 
languages.")
               (patches (search-patches "gcc-8-strmov-store-file-names.patch"
                                        
"gcc-7-libsanitizer-fsconfig-command.patch"
                                        "gcc-5.0-libvtv-runpath.patch"
-                                       "gcc-8-sort-libtool-find-output.patch"))
+                                       "gcc-8-sort-libtool-find-output.patch"
+                                       "gcc-build-with-gcc-14.patch"))
               (modules '((guix build utils)))
               (snippet gcc-canadian-cross-objdump-snippet)))))
 
@@ -739,7 +748,8 @@ It also includes runtime support libraries for these 
languages.")
                                      
"gcc-13.2.0-libstdc++-info-install-fix.patch"
                                      "gcc-9-strmov-store-file-names.patch"
                                      "gcc-9-asan-fix-limits-include.patch"
-                                     "gcc-5.0-libvtv-runpath.patch"))
+                                     "gcc-5.0-libvtv-runpath.patch"
+                                     "gcc-build-with-gcc-14.patch"))
             (modules '((guix build utils)))
             (snippet gcc-canadian-cross-objdump-snippet)))))
 
@@ -756,7 +766,8 @@ It also includes runtime support libraries for these 
languages.")
               "1h87lcfaga0ydsf4pkhwlnjr8mky5ix8npbv6iy3jvzlzm1ra415"))
             (patches (search-patches "gcc-9-strmov-store-file-names.patch"
                                      "gcc-5.0-libvtv-runpath.patch"
-                                     "gcc-10-libsanitizer-no-crypt.patch"))
+                                     "gcc-10-libsanitizer-no-crypt.patch"
+                                     "gcc-build-with-gcc-14.patch"))
             (modules '((guix build utils)))
             (snippet gcc-canadian-cross-objdump-snippet)))
    (properties
@@ -782,7 +793,8 @@ It also includes runtime support libraries for these 
languages.")
             (patches (search-patches "gcc-9-strmov-store-file-names.patch"
                                      "gcc-5.0-libvtv-runpath.patch"
                                      "gcc-10-libsanitizer-no-crypt.patch"
-                                     "gcc-11-libstdc++-hurd-libpthread.patch"))
+                                     "gcc-11-libstdc++-hurd-libpthread.patch"
+                                     "gcc-build-with-gcc-14.patch"))
             (modules '((guix build utils)))
             (snippet gcc-canadian-cross-objdump-snippet)))
    (properties
@@ -808,7 +820,8 @@ It also includes runtime support libraries for these 
languages.")
               (patches (search-patches "gcc-12-strmov-store-file-names.patch"
                                        "gcc-5.0-libvtv-runpath.patch"
                                        "gcc-12-libsanitizer-no-crypt.patch"
-                                       
"gcc-11-libstdc++-hurd-libpthread.patch"))
+                                       "gcc-11-libstdc++-hurd-libpthread.patch"
+                                       "gcc-build-with-gcc-14.patch"))
               (modules '((guix build utils)))
               (snippet gcc-canadian-cross-objdump-snippet)))
    (properties
@@ -833,7 +846,8 @@ It also includes runtime support libraries for these 
languages.")
                 "10y0l1hx1haz4cj4d4g9f2ci5h7z9555i52f90zs2hwm3iifji88"))
               (patches (search-patches "gcc-12-strmov-store-file-names.patch"
                                        "gcc-5.0-libvtv-runpath.patch"
-                                       "gcc-13-libsanitizer-no-crypt.patch"))
+                                       "gcc-13-libsanitizer-no-crypt.patch"
+                                       "gcc-build-with-gcc-14.patch"))
               (modules '((guix build utils)))
               (snippet gcc-canadian-cross-objdump-snippet)))
     (arguments
diff --git a/gnu/packages/patches/gcc-build-with-gcc-14.patch 
b/gnu/packages/patches/gcc-build-with-gcc-14.patch
new file mode 100644
index 0000000000..8c55e4250e
--- /dev/null
+++ b/gnu/packages/patches/gcc-build-with-gcc-14.patch
@@ -0,0 +1,50 @@
+From 5816810bf835a2e404f8ff2836b5cd1202e3e7e1 Mon Sep 17 00:00:00 2001
+From: Janneke Nieuwenhuizen <[email protected]>
+Date: Sun, 15 Dec 2024 19:33:53 +0100
+Subject: [PATCH] Fix build with gcc-14.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This avoids
+
+    libstdc++-v3/src/c++98/compatibility.cc:392:4: error: ‘void 
{anonymous}::_Y_ZNSt13basic_istreamIwSt11char_traitsIwEE6ignoreEi(...)’ aliased 
to undefined symbol ‘_ZNSt13basic_istreamIwSt11char_traitsIwEE8ignoreXXEi’
+      392 |    _Y##name(...) \
+          |    ^~
+    ../../../../gcc-11.4.0/libstdc++-v3/src/c++98/compatibility.cc:403:31: 
note: in expansion of macro ‘_GLIBCXX_3_4_5_SYMVER’
+      403 | #define _GLIBCXX_APPLY_SYMVER _GLIBCXX_3_4_5_SYMVER
+          |                               ^~~~~~~~~~~~~~~~~~~~~
+   .../include/x86_64-unknown-linux-gnu/bits/compatibility.h:196:1: note: in 
expansion of macro ‘_GLIBCXX_APPLY_SYMVER’
+      196 | 
_GLIBCXX_APPLY_SYMVER(_ZNSt13basic_istreamIwSt11char_traitsIwEE8ignoreXXEi,
+          | ^~~~~~~~~~~~~~~
+
+* libstdc++-v3/src/c++98/compatibility.cc (_GLIBCXX_APPLY_SYMVER)
+[__GNUC__ >= 14]: Disable.
+---
+ libstdc++-v3/src/c++98/compatibility.cc | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/libstdc++-v3/src/c++98/compatibility.cc 
b/libstdc++-v3/src/c++98/compatibility.cc
+index 5ab8945a474..0e1b226a39f 100644
+--- a/libstdc++-v3/src/c++98/compatibility.cc
++++ b/libstdc++-v3/src/c++98/compatibility.cc
+@@ -380,6 +380,8 @@ _GLIBCXX_END_NAMESPACE_VERSION
+ #define _GLIBCXX_ASM_SYMVER(cur, old, version) \
+    asm (".symver " #cur "," #old "@@" #version);
+ 
++#if 0 // _GLIBCXX_RELEASE < 14 // __GNUC__ < 14 These do not compile with 
gcc-14.2 headers
++// These do not compile with gcc-14.2
+ #define _GLIBCXX_APPLY_SYMVER _GLIBCXX_3_4_SYMVER
+ #include <bits/compatibility.h>
+ #undef _GLIBCXX_APPLY_SYMVER
+@@ -387,6 +389,7 @@ _GLIBCXX_END_NAMESPACE_VERSION
+ #define _GLIBCXX_APPLY_SYMVER _GLIBCXX_3_4_5_SYMVER
+ #include <bits/compatibility.h>
+ #undef _GLIBCXX_APPLY_SYMVER
++#endif
+ 
+ 
+ /* gcc-3.4.0
+-- 
+2.46.0
+

Reply via email to