all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#61879: [core-updates] libstdc++ fails to build on powerpc64le-linux
@ 2023-02-28 23:16 Ludovic Courtès
  2023-04-13  9:32 ` Powerpc on core-updates Andreas Enge
  2023-04-13 16:57 ` bug#61879: Patch Andreas Enge
  0 siblings, 2 replies; 11+ messages in thread
From: Ludovic Courtès @ 2023-02-28 23:16 UTC (permalink / raw)
  To: 61879

From <https://ci.guix.gnu.org/build/440447/details> (commit
0825162a35362640b47d3cabe278fd7ea49140bd and later):

--8<---------------cut here---------------start------------->8---
libtool: compile:  g++ -I/tmp/guix-build-libstdc++-11.3.0.drv-0/gcc-11.3.0/libstdc++-v3/../libgcc -I/tmp/guix-build-libstdc++-11.3.0.drv-0/gcc-11.3.0/build/include/ -I/tmp/guix-build-libstdc++-11.3.0.drv-0/gcc-11.3.0/build/include -I/tmp/guix-build-libstdc++-11.3.0.drv-0/gcc-11.3.0/libstdc++-v3/libsupc++ -std=gnu++17 -nostdinc++ -fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2 -fdiagnostics-show-location=once -ffunction-sections -fdata-sections -frandom-seed=fs_path.lo -mno-gnu-attribute -fimplicit-templates -c ../../../libstdc++-v3/src/c++17/fs_path.cc
../../../libstdc++-v3/src/c++17/floating_from_chars.cc: In function 'std::from_chars_result std::from_chars(const char*, const char*, __ieee128&, std::chars_format)':
../../../libstdc++-v3/src/c++17/floating_from_chars.cc:499:8: error: 'string' is not a member of 'std::pmr'; did you mean 'std::string'?
  499 |   pmr::string buf(&mr);
      |        ^~~~~~
In file included from /tmp/guix-build-libstdc++-11.3.0.drv-0/gcc-11.3.0/build/include/string:39,
                 from ../../../libstdc++-v3/src/c++17/floating_from_chars.cc:34:
/tmp/guix-build-libstdc++-11.3.0.drv-0/gcc-11.3.0/build/include/bits/stringfwd.h:79:33: note: 'std::string' declared here
   79 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
../../../libstdc++-v3/src/c++17/floating_from_chars.cc:504:55: error: 'buf' was not declared in this scope
  504 |       if (const char* pat = pattern(first, last, fmt, buf)) [[likely]]
      |                                                       ^~~
make[3]: *** [Makefile:762: floating_from_chars.lo] Error 1
make[3]: *** Waiting for unfinished jobs....
In file included from ../../../libstdc++-v3/src/c++17/fs_ops.cc:58:
../../../libstdc++-v3/src/c++17/../filesystem/ops-common.h: In function 'std::filesystem::file_type std::filesystem::make_file_type(const stat_type&)':
../../../libstdc++-v3/src/c++17/../filesystem/ops-common.h:269:35: warning: unused parameter 'st' [-Wunused-parameter]
  269 |   make_file_type(const stat_type& st) noexcept
      |                  ~~~~~~~~~~~~~~~~~^~
make[3]: Leaving directory '/tmp/guix-build-libstdc++-11.3.0.drv-0/gcc-11.3.0/build/src/c++17'
make[2]: *** [Makefile:765: all-recursive] Error 1
make[2]: Leaving directory '/tmp/guix-build-libstdc++-11.3.0.drv-0/gcc-11.3.0/build/src'
make[1]: *** [Makefile:568: all-recursive] Error 1
make[1]: Leaving directory '/tmp/guix-build-libstdc++-11.3.0.drv-0/gcc-11.3.0/build'
make: *** [Makefile:493: all] Error 2
error: in phase 'build': uncaught exception:
srfi-34 #<condition &invoke-error [program: "make" arguments: ("-j" "32") exit-status: 2 term-signal: #f stop-signal: #f] 7fffefc213c0> 
phase `build' failed after 6.0 seconds
command "make" "-j" "32" failed with status 2
builder for `/gnu/store/bpx8ar4qq4bkskhhj25l5phxxji0ljf8-libstdc++-11.3.0.drv' failed with exit code 1
@ build-failed /gnu/store/bpx8ar4qq4bkskhhj25l5phxxji0ljf8-libstdc++-11.3.0.drv - 1 builder for `/gnu/store/bpx8ar4qq4bkskhhj25l5phxxji0ljf8-libstdc++-11.3.0.drv' failed with exit code 1
--8<---------------cut here---------------end--------------->8---

Ludo’.




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Powerpc on core-updates
@ 2023-04-13  9:32 ` Andreas Enge
  2023-04-13  9:51   ` Andreas Enge
  2023-04-13 13:46   ` bug#61879: " Christopher Baines
  0 siblings, 2 replies; 11+ messages in thread
From: Andreas Enge @ 2023-04-13  9:32 UTC (permalink / raw)
  To: guix-devel; +Cc: Efraim Flashner, 61879

Hello,

recently I claimed that powerpc was repaired, but I must have made a mistake.
It is still completely broken:
   https://ci.guix.gnu.org/eval/391720/dashboard?system=powerpc64le-linux
due to this:
   https://issues.guix.gnu.org/61879
 
It does not look easy to fix, but might be *the* blocker for a core-updates
merge...

The error is this:
../../../libstdc++-v3/src/c++17/floating_from_chars.cc: In function 'std::from_chars_result std::from_chars(const char*, const char*, __ieee128&, std::chars_format)':
../../../libstdc++-v3/src/c++17/floating_from_chars.cc:499:8: error: 'string' is not a member of 'std::pmr'; did you mean 'std::string'?
  499 |   pmr::string buf(&mr);
      |        ^~~~~~
In file included from /tmp/guix-build-libstdc++-11.3.0.drv-0/gcc-11.3.0/build/include/string:39,
                 from ../../../libstdc++-v3/src/c++17/floating_from_chars.cc:34:
/tmp/guix-build-libstdc++-11.3.0.drv-0/gcc-11.3.0/build/include/bits/stringfwd.h:79:33: note: 'std::string' declared here
   79 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
../../../libstdc++-v3/src/c++17/floating_from_chars.cc:504:55: error: 'buf' was not declared in this scope
  504 |       if (const char* pat = pattern(first, last, fmt, buf)) [[likely]]

In the file
   libstdc++-v3/src/c++17/floating_from_chars.cc
previous functions have code like this:
#if _GLIBCXX_USE_CXX11_ABI
  buffer_resource mr;
  pmr::string buf(&mr);
#else
  string buf;
  if (!reserve_string(buf))
    return make_result(first, 0, {}, ec);
#endif

while here we only have:
  buffer_resource mr;
  pmr::string buf(&mr);

So my guess would be that we should simply replace this snippet with the
one above.

Could someone with access to a powerpc machine try out this change?

Andreas



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Powerpc on core-updates
  2023-04-13  9:32 ` Powerpc on core-updates Andreas Enge
@ 2023-04-13  9:51   ` Andreas Enge
  2023-04-13 13:46   ` bug#61879: " Christopher Baines
  1 sibling, 0 replies; 11+ messages in thread
From: Andreas Enge @ 2023-04-13  9:51 UTC (permalink / raw)
  To: guix-devel; +Cc: Efraim Flashner, 61879

[-- Attachment #1: Type: text/plain, Size: 302 bytes --]

I may as well try to provide a patch. It is untested even on x86_64,
since it requires quite a few rebuilds. If it works on powerpc, it should
probably be made conditional on the architecture to avoid a world rebuild.
I do not know whether this is possible in the patches field in an origin.

Andreas


[-- Attachment #2: 0001-gnu-gcc-11-Fix-build-on-powerpc64le.patch --]
[-- Type: text/plain, Size: 3561 bytes --]

From 5eb50bdc34759d4c917f2143e037fad62bc08ed7 Mon Sep 17 00:00:00 2001
From: Andreas Enge <andreas@enge.fr>
Date: Thu, 13 Apr 2023 11:46:47 +0200
Subject: [PATCH] gnu: gcc-11: Fix build on powerpc64le.

* gnu/packages/patches/gcc-11-libstdc++-powerpc.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register patch.
* gnu/packages/gcc.scm (gcc-11)[origin]: Use patch.
---
 gnu/local.mk                                   |  1 +
 gnu/packages/gcc.scm                           |  5 +++--
 .../patches/gcc-11-libstdc++-powerpc.patch     | 18 ++++++++++++++++++
 3 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 gnu/packages/patches/gcc-11-libstdc++-powerpc.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index b07811f1cb..1255846462 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1184,6 +1184,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/gcc-11-libstdc++-hurd-libpthread.patch   \
   %D%/packages/patches/gcc-12-cross-environment-variables.patch \
   %D%/packages/patches/gcc-10-tree-sra-union-handling.patch	\
+  %D%/packages/patches/gcc-11-libstdc++-powerpc.patch           \
   %D%/packages/patches/gcolor3-update-libportal-usage.patch	\
   %D%/packages/patches/gd-fix-tests-on-i686.patch		\
   %D%/packages/patches/gd-brect-bounds.patch			\
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index a511cdbc45..631e08db25 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -2,7 +2,7 @@
 ;;; Copyright © 2012-2023 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2014, 2015, 2018 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2014, 2015, 2016, 2017, 2019, 2021 Ricardo Wurmus <rekado@elephly.net>
-;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
+;;; Copyright © 2015, 2023 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2015-2018, 2020-2023 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2016 Carlos Sánchez de La Lama <csanchezdll@gmail.com>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
@@ -703,7 +703,8 @@ (define-public gcc-11
               "0fdclcwf728wbq52vphfcjywzhpsjp3kifzj3pib3xcihs0z4z5l"))
             (patches (search-patches "gcc-9-strmov-store-file-names.patch"
                                      "gcc-5.0-libvtv-runpath.patch"
-                                     "gcc-10-tree-sra-union-handling.patch"))
+                                     "gcc-10-tree-sra-union-handling.patch"
+                                     "gcc-11-libstdc++-powerpc.patch"))
             (modules '((guix build utils)))
             (snippet gcc-canadian-cross-objdump-snippet)))
    (arguments
diff --git a/gnu/packages/patches/gcc-11-libstdc++-powerpc.patch b/gnu/packages/patches/gcc-11-libstdc++-powerpc.patch
new file mode 100644
index 0000000000..aff2ef16f1
--- /dev/null
+++ b/gnu/packages/patches/gcc-11-libstdc++-powerpc.patch
@@ -0,0 +1,18 @@
+diff -u -r gcc-11.3.0.alt/libstdc++-v3/src/c++17/floating_from_chars.cc gcc-11.3.0/libstdc++-v3/src/c++17/floating_from_chars.cc
+--- gcc-11.3.0.alt/libstdc++-v3/src/c++17/floating_from_chars.cc	2023-04-13 11:36:08.169841428 +0200
++++ gcc-11.3.0/libstdc++-v3/src/c++17/floating_from_chars.cc	2023-04-13 11:36:54.825827304 +0200
+@@ -495,8 +495,14 @@
+ from_chars(const char* first, const char* last, __ieee128& value,
+ 	   chars_format fmt) noexcept
+ {
++#if _GLIBCXX_USE_CXX11_ABI
+   buffer_resource mr;
+   pmr::string buf(&mr);
++#else
++  string buf;
++  if (!reserve_string(buf))
++    return make_result(first, 0, {}, ec);
++#endif
+   size_t len = 0;
+   errc ec = errc::invalid_argument;
+   __try
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: bug#61879: Powerpc on core-updates
  2023-04-13  9:32 ` Powerpc on core-updates Andreas Enge
  2023-04-13  9:51   ` Andreas Enge
@ 2023-04-13 13:46   ` Christopher Baines
  2023-04-13 14:06     ` Andreas Enge
  1 sibling, 1 reply; 11+ messages in thread
From: Christopher Baines @ 2023-04-13 13:46 UTC (permalink / raw)
  To: Andreas Enge; +Cc: guix-devel, 61879, Efraim Flashner


[-- Attachment #1.1: Type: text/plain, Size: 910 bytes --]


Andreas Enge <andreas@enge.fr> writes:

> In the file
>    libstdc++-v3/src/c++17/floating_from_chars.cc
> previous functions have code like this:
> #if _GLIBCXX_USE_CXX11_ABI
>   buffer_resource mr;
>   pmr::string buf(&mr);
> #else
>   string buf;
>   if (!reserve_string(buf))
>     return make_result(first, 0, {}, ec);
> #endif
>
> while here we only have:
>   buffer_resource mr;
>   pmr::string buf(&mr);
>
> So my guess would be that we should simply replace this snippet with the
> one above.
>
> Could someone with access to a powerpc machine try out this change?

Thanks for figuring this out Andreas! I've managed to apply this change
in the relevant place, and it appears to work.

I tried to apply it in a way that only affected powerpc64le-linux, but
I'm not sure I was successful. I've got no idea where it's best to apply
this patch, or how describe it, but at least this is a step forward.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-WIP.patch --]
[-- Type: text/x-patch, Size: 7996 bytes --]

From 382862fc06085ba80380977caf2a1f9c3203a12d Mon Sep 17 00:00:00 2001
From: Christopher Baines <mail@cbaines.net>
Date: Thu, 13 Apr 2023 14:45:14 +0100
Subject: [PATCH] WIP

---
 gnu/packages/gcc.scm           | 108 ++++++++++++++++++---------------
 gnu/packages/patches/foo.patch |  20 ++++++
 2 files changed, 80 insertions(+), 48 deletions(-)
 create mode 100644 gnu/packages/patches/foo.patch

diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index a511cdbc45..6f6f2caa5e 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -853,56 +853,68 @@ (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 = ")))))))
-               '())
-         ;; 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"))))
+      #:phases
+      #~(modify-phases %standard-phases
+          #$@(if (and (target-ppc64le?)
+                      (version>=? (package-version gcc) "11"))
+                 #~((add-after 'unpack 'patch-foo
+                      (lambda _
+                        (define patch
+                          #$(local-file
+                             (search-patch "foo.patch")))
+                        (peek "CWD" (getcwd))
+                        (invoke "patch" "--force" "-p1" "-i" patch))))
+                 '())
+          #$@(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 = ")))))))
+                 '())
+          ;; 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 #~(list
+                           "--disable-libstdcxx-pch"
+                           (string-append "--with-gxx-include-dir="
+                                          #$output
+                                          "/include"))))
     (outputs '("out" "debug"))
     (inputs '())
     (native-inputs '())
diff --git a/gnu/packages/patches/foo.patch b/gnu/packages/patches/foo.patch
new file mode 100644
index 0000000000..5f3ccda91d
--- /dev/null
+++ b/gnu/packages/patches/foo.patch
@@ -0,0 +1,20 @@
+--- a/libstdc++-v3/src/c++17/floating_from_chars.cc
++++ b/libstdc++-v3/src/c++17/floating_from_chars.cc
+@@ -495,10 +495,16 @@
+ from_chars(const char* first, const char* last, __ieee128& value,
+          chars_format fmt) noexcept
+ {
++  errc ec = errc::invalid_argument;
++#if _GLIBCXX_USE_CXX11_ABI
+   buffer_resource mr;
+   pmr::string buf(&mr);
++#else
++  string buf;
++  if (!reserve_string(buf))
++    return make_result(first, 0, {}, ec);
++#endif
+   size_t len = 0;
+-  errc ec = errc::invalid_argument;
+   __try
+     {
+       if (const char* pat = pattern(first, last, fmt, buf)) [[likely]]
-- 
2.32.0



[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 987 bytes --]

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: bug#61879: Powerpc on core-updates
  2023-04-13 13:46   ` bug#61879: " Christopher Baines
@ 2023-04-13 14:06     ` Andreas Enge
  0 siblings, 0 replies; 11+ messages in thread
From: Andreas Enge @ 2023-04-13 14:06 UTC (permalink / raw)
  To: Christopher Baines; +Cc: guix-devel, 61879

Am Thu, Apr 13, 2023 at 02:46:00PM +0100 schrieb Christopher Baines:
> Thanks for figuring this out Andreas! I've managed to apply this change
> in the relevant place, and it appears to work.

Good news, thanks!

> +          #$@(if (and (target-ppc64le?)
> +                      (version>=? (package-version gcc) "11"))

The file changed a lot on master, and the patch will not apply and
should not be needed there. I did not check, but I think it is already
not needed for gcc@12 any more. So we should probably check for the
major version being equal to 11.

It should be easy to check that it does not cause any rebuilds on the
other architectures, and we cannot break powerpc more than it already
is, so feel free to push something along these lines to core-updates.

Andreas



^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#61879: Patch
  2023-02-28 23:16 bug#61879: [core-updates] libstdc++ fails to build on powerpc64le-linux Ludovic Courtès
  2023-04-13  9:32 ` Powerpc on core-updates Andreas Enge
@ 2023-04-13 16:57 ` Andreas Enge
  2023-04-14  8:15   ` Andreas Enge
  1 sibling, 1 reply; 11+ messages in thread
From: Andreas Enge @ 2023-04-13 16:57 UTC (permalink / raw)
  To: 61879, Christopher Baines

[-- Attachment #1: Type: text/plain, Size: 343 bytes --]

Hello,

attached is a new commit in old syntax, mixing both our commits.
I have confirmed that it does not change the gcc-11 build on x86_64 and i686.
But do we need "--force" for patching?

Could you maybe check again whether this builds gcc-11 on powerpc?

If yes, we can push it, and feel free to gexpify it in a separate commit.

Andreas


[-- Attachment #2: 0001-gnu-gcc-11-Fix-build-on-powerpc64le.patch --]
[-- Type: text/plain, Size: 3837 bytes --]

From 9900f9e9b86550e7d336b04ad46fba088e28cbd6 Mon Sep 17 00:00:00 2001
From: Andreas Enge <andreas@enge.fr>
Date: Thu, 13 Apr 2023 11:46:47 +0200
Subject: [PATCH] gnu: gcc-11: Fix build on powerpc64le.

* gnu/packages/patches/gcc-11-libstdc++-powerpc.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register patch.
* gnu/packages/gcc.scm (make-libstdc++): Apply patch for gcc versions >= 11
and < 12 on ppc64le.

Co-authored-by: Christopher Baines <mail@cbaines.net>
---
 gnu/local.mk                                   |  1 +
 gnu/packages/gcc.scm                           | 11 ++++++++++-
 .../patches/gcc-11-libstdc++-powerpc.patch     | 18 ++++++++++++++++++
 3 files changed, 29 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/gcc-11-libstdc++-powerpc.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index b07811f1cb..1255846462 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1184,6 +1184,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/gcc-11-libstdc++-hurd-libpthread.patch   \
   %D%/packages/patches/gcc-12-cross-environment-variables.patch \
   %D%/packages/patches/gcc-10-tree-sra-union-handling.patch	\
+  %D%/packages/patches/gcc-11-libstdc++-powerpc.patch           \
   %D%/packages/patches/gcolor3-update-libportal-usage.patch	\
   %D%/packages/patches/gd-fix-tests-on-i686.patch		\
   %D%/packages/patches/gd-brect-bounds.patch			\
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index a511cdbc45..ae324219d3 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -2,7 +2,7 @@
 ;;; Copyright © 2012-2023 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2014, 2015, 2018 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2014, 2015, 2016, 2017, 2019, 2021 Ricardo Wurmus <rekado@elephly.net>
-;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
+;;; Copyright © 2015, 2023 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2015-2018, 2020-2023 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2016 Carlos Sánchez de La Lama <csanchezdll@gmail.com>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
@@ -889,6 +889,15 @@ (define-public (make-libstdc++ gcc)
                                           ":")
                                          "\nAM_CXXFLAGS = ")))))))
                '())
+         ,@(let ((version (package-version gcc)))
+                (if (and (target-ppc64le?)
+                    (version>=? version "11")
+                    (not (version>=? version "12")))
+               `((add-after 'unpack 'patch-powerpc
+                   (lambda _
+                    (invoke "patch" "--force" "-p1" "-i"
+                            (search-patch "gcc-11-libstdc++-powerpc.patch")))))
+               '()))
          ;; Force rs6000 (i.e., powerpc) libdir to be /lib and not /lib64.
          (add-before 'chdir 'fix-rs6000-libdir
            (lambda _
diff --git a/gnu/packages/patches/gcc-11-libstdc++-powerpc.patch b/gnu/packages/patches/gcc-11-libstdc++-powerpc.patch
new file mode 100644
index 0000000000..aff2ef16f1
--- /dev/null
+++ b/gnu/packages/patches/gcc-11-libstdc++-powerpc.patch
@@ -0,0 +1,18 @@
+diff -u -r gcc-11.3.0.alt/libstdc++-v3/src/c++17/floating_from_chars.cc gcc-11.3.0/libstdc++-v3/src/c++17/floating_from_chars.cc
+--- gcc-11.3.0.alt/libstdc++-v3/src/c++17/floating_from_chars.cc	2023-04-13 11:36:08.169841428 +0200
++++ gcc-11.3.0/libstdc++-v3/src/c++17/floating_from_chars.cc	2023-04-13 11:36:54.825827304 +0200
+@@ -495,8 +495,14 @@
+ from_chars(const char* first, const char* last, __ieee128& value,
+ 	   chars_format fmt) noexcept
+ {
++#if _GLIBCXX_USE_CXX11_ABI
+   buffer_resource mr;
+   pmr::string buf(&mr);
++#else
++  string buf;
++  if (!reserve_string(buf))
++    return make_result(first, 0, {}, ec);
++#endif
+   size_t len = 0;
+   errc ec = errc::invalid_argument;
+   __try
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* bug#61879: Patch
  2023-04-13 16:57 ` bug#61879: Patch Andreas Enge
@ 2023-04-14  8:15   ` Andreas Enge
  2023-04-14  8:20     ` Christopher Baines
  0 siblings, 1 reply; 11+ messages in thread
From: Andreas Enge @ 2023-04-14  8:15 UTC (permalink / raw)
  To: 61879, Christopher Baines

Am Thu, Apr 13, 2023 at 06:57:41PM +0200 schrieb Andreas Enge:
> attached is a new commit in old syntax, mixing both our commits.
> I have confirmed that it does not change the gcc-11 build on x86_64 and i686.
> But do we need "--force" for patching?
> Could you maybe check again whether this builds gcc-11 on powerpc?

I just pushed it, since it cannot break much... If CI shows it does not
work, we can still revert it.

Andreas





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#61879: Patch
  2023-04-14  8:15   ` Andreas Enge
@ 2023-04-14  8:20     ` Christopher Baines
  2023-04-14  9:42       ` Andreas Enge
  0 siblings, 1 reply; 11+ messages in thread
From: Christopher Baines @ 2023-04-14  8:20 UTC (permalink / raw)
  To: Andreas Enge; +Cc: 61879

[-- Attachment #1: Type: text/plain, Size: 693 bytes --]


Andreas Enge <andreas@enge.fr> writes:

> Am Thu, Apr 13, 2023 at 06:57:41PM +0200 schrieb Andreas Enge:
>> attached is a new commit in old syntax, mixing both our commits.
>> I have confirmed that it does not change the gcc-11 build on x86_64 and i686.
>> But do we need "--force" for patching?
>> Could you maybe check again whether this builds gcc-11 on powerpc?
>
> I just pushed it, since it cannot break much... If CI shows it does not
> work, we can still revert it.

I haven't tried this yet, but I've had a quick look. I'm not sure
search-patches will work where it is, since that'll be running in the
build environment, without any access to the patches in the Guix git
repository.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 987 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#61879: Patch
  2023-04-14  8:20     ` Christopher Baines
@ 2023-04-14  9:42       ` Andreas Enge
  2023-04-14 10:37         ` Christopher Baines
  0 siblings, 1 reply; 11+ messages in thread
From: Andreas Enge @ 2023-04-14  9:42 UTC (permalink / raw)
  To: Christopher Baines; +Cc: 61879

Am Fri, Apr 14, 2023 at 09:20:03AM +0100 schrieb Christopher Baines:
> I haven't tried this yet, but I've had a quick look. I'm not sure
> search-patches will work where it is, since that'll be running in the
> build environment, without any access to the patches in the Guix git
> repository.

Good point. But is this not exactly like your previous commit, which
I understood you had tested? But you are right:
   https://ci.guix.gnu.org/build/909454/log/raw
error: in phase 'patch-powerpc': uncaught exception:
unbound-variable #f "Unbound variable: ~S" (search-patch) #f 
phase `patch-powerpc' failed after 0.0 seconds
I will revert (the good news: it indeed did not break any other
architecture).

If we do not have access to the patch during build, we would need to
replace it by an invocation of substitute*, with a lot of escaping of
special characters like line ends, which would be annoying to test
(well, one could test on x86_64 on a dummy package with the same source
as gcc-11).

Andreas





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#61879: Patch
  2023-04-14  9:42       ` Andreas Enge
@ 2023-04-14 10:37         ` Christopher Baines
  2023-04-14 12:10           ` Andreas Enge
  0 siblings, 1 reply; 11+ messages in thread
From: Christopher Baines @ 2023-04-14 10:37 UTC (permalink / raw)
  To: Andreas Enge; +Cc: 61879

[-- Attachment #1: Type: text/plain, Size: 1428 bytes --]


Andreas Enge <andreas@enge.fr> writes:

> Am Fri, Apr 14, 2023 at 09:20:03AM +0100 schrieb Christopher Baines:
>> I haven't tried this yet, but I've had a quick look. I'm not sure
>> search-patches will work where it is, since that'll be running in the
>> build environment, without any access to the patches in the Guix git
>> repository.
>
> Good point. But is this not exactly like your previous commit, which
> I understood you had tested? But you are right:
>    https://ci.guix.gnu.org/build/909454/log/raw
> error: in phase 'patch-powerpc': uncaught exception:
> unbound-variable #f "Unbound variable: ~S" (search-patch) #f 
> phase `patch-powerpc' failed after 0.0 seconds
> I will revert (the good news: it indeed did not break any other
> architecture).
>
> If we do not have access to the patch during build, we would need to
> replace it by an invocation of substitute*, with a lot of escaping of
> special characters like line ends, which would be annoying to test
> (well, one could test on x86_64 on a dummy package with the same source
> as gcc-11).

The changes I muddled together differed in that the search-patches bit
was ungexp'ed, so the patch file was handled through that mechanism. The
other important change is the actual patch itself differed as well (ec
needs moving up a bit).

I've made those changes to the commit you pushed earlier and pushed to
core-updates now.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 987 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#61879: Patch
  2023-04-14 10:37         ` Christopher Baines
@ 2023-04-14 12:10           ` Andreas Enge
  0 siblings, 0 replies; 11+ messages in thread
From: Andreas Enge @ 2023-04-14 12:10 UTC (permalink / raw)
  To: Christopher Baines; +Cc: 61879-done

Am Fri, Apr 14, 2023 at 11:37:05AM +0100 schrieb Christopher Baines:
> I've made those changes to the commit you pushed earlier and pushed to
> core-updates now.

That did it, lots of green dots in the dashboard. Thanks!

Closing the bug now.

Andreas





^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-04-14 12:11 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-28 23:16 bug#61879: [core-updates] libstdc++ fails to build on powerpc64le-linux Ludovic Courtès
2023-04-13  9:32 ` Powerpc on core-updates Andreas Enge
2023-04-13  9:51   ` Andreas Enge
2023-04-13 13:46   ` bug#61879: " Christopher Baines
2023-04-13 14:06     ` Andreas Enge
2023-04-13 16:57 ` bug#61879: Patch Andreas Enge
2023-04-14  8:15   ` Andreas Enge
2023-04-14  8:20     ` Christopher Baines
2023-04-14  9:42       ` Andreas Enge
2023-04-14 10:37         ` Christopher Baines
2023-04-14 12:10           ` Andreas Enge

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.