bug#61879: Patch

2023-04-14 Thread Andreas Enge
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






bug#61879: Patch

2023-04-14 Thread Christopher Baines

Andreas Enge  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.


signature.asc
Description: PGP signature


bug#61879: Patch

2023-04-14 Thread Andreas Enge
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






bug#61879: Patch

2023-04-14 Thread Christopher Baines

Andreas Enge  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.


signature.asc
Description: PGP signature


bug#61879: Patch

2023-04-14 Thread Andreas Enge
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






bug#61879: Patch

2023-04-13 Thread Andreas Enge
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

>From 9900f9e9b86550e7d336b04ad46fba088e28cbd6 Mon Sep 17 00:00:00 2001
From: Andreas Enge 
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 
---
 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 
 ;;; Copyright © 2014, 2015, 2018 Mark H Weaver 
 ;;; Copyright © 2014, 2015, 2016, 2017, 2019, 2021 Ricardo Wurmus 

-;;; Copyright © 2015 Andreas Enge 
+;;; Copyright © 2015, 2023 Andreas Enge 
 ;;; Copyright © 2015-2018, 2020-2023 Efraim Flashner 
 ;;; Copyright © 2016 Carlos Sánchez de La Lama 
 ;;; Copyright © 2018 Tobias Geerinckx-Rice 
@@ -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 00..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();
++#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