unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#49880] [PATCH 1/2] gnu: gmp-boot: Fix build on powerpc64le-linux
@ 2021-08-04 18:34 Thiago Jung Bauermann via Guix-patches via
  2021-08-04 18:41 ` [bug#49880] [PATCH 2/2] gnu: gmp-boot: Fix t-scan test crash Thiago Jung Bauermann via Guix-patches via
  2021-08-11 21:29 ` Ludovic Courtès
  0 siblings, 2 replies; 5+ messages in thread
From: Thiago Jung Bauermann via Guix-patches via @ 2021-08-04 18:34 UTC (permalink / raw)
  To: 49880; +Cc: Thiago Jung Bauermann

Linux on powerpc64 used to run in big-endian mode only.  When support for
little-endian mode was added around 2014, they took the opportunity to
update the ELF ABI.  The new ABI is known as ELF ABI v2, and the old one
retroactively called ELF ABI v1.

GMP 4.3.2 was released in 2010, so its hand-optimized assembly code for
powerpc64 only support ELF ABI v1.  This causes a build failure on
powerpc64le-linux, which can be fixed by passing a host triplet with the
“none” CPU type.  This tells the configure script to use generic C code for
the build.

* gnu/packages/commencement.scm (gmp-boot)[arguments]{#:configure-flags}: Add
“--host=none-unknown-linux-gnu” for powerpc64le targets.
---

Hello,

This patch fixes the following build error on powerpc64le-linux (shown
below for one file, but happens on several):

ld: mpn/.libs/add_n.o: ABI version 1 is not compatible with ABI version 2 output
ld: failed to merge target specific data of file mpn/.libs/add_n.o

I started investigating the problem in core-udpates-frozen but the same
issue happens in master as well so I suggest comitting it there instead.
The patch applies cleanly to both branches.

Thanks,
Thiago

 gnu/packages/commencement.scm | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index e7bd6cf002c7..ae3f07bc59ef 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -1840,7 +1840,23 @@ ac_cv_c_float_format='IEEE (little-endian)'
               (uri (string-append "mirror://gnu/gmp/gmp-" version
                                   ".tar.gz"))
               (sha256 (base32
-                       "15rwq54fi3s11izas6g985y9jklm3xprfsmym3v1g6xr84bavqvv"))))))
+                       "15rwq54fi3s11izas6g985y9jklm3xprfsmym3v1g6xr84bavqvv"))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments gmp)
+       ((#:configure-flags gmp-configure-flags)
+        `(cons* ,@(if (string-prefix? "powerpc64le-" (or (%current-target-system)
+                                                         (%current-system)))
+                      ;; The powerpc64 assembly code in this version of GMP
+                      ;; only supports the ELF ABI v1 but powerpc64le uses ELF
+                      ;; ABI v2, so use the generic C code instead.  This is
+                      ;; done by specifying the CPU type as “none”.
+                      ;;
+                      ;; According to the manual, “this will run quite slowly,
+                      ;; but it should be portable and should at least make it
+                      ;; possible to get something running if all else fails.”
+                      '("--host=none-unknown-linux-gnu")
+                      '())
+                ,gmp-configure-flags))))))
 
 (define mpfr-boot
   (package




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

* [bug#49880] [PATCH 2/2] gnu: gmp-boot: Fix t-scan test crash
  2021-08-04 18:34 [bug#49880] [PATCH 1/2] gnu: gmp-boot: Fix build on powerpc64le-linux Thiago Jung Bauermann via Guix-patches via
@ 2021-08-04 18:41 ` Thiago Jung Bauermann via Guix-patches via
  2021-08-04 18:51   ` Thiago Jung Bauermann via Guix-patches via
  2021-08-11 21:34   ` [bug#49880] [PATCH 1/2] gnu: gmp-boot: Fix build on powerpc64le-linux Ludovic Courtès
  2021-08-11 21:29 ` Ludovic Courtès
  1 sibling, 2 replies; 5+ messages in thread
From: Thiago Jung Bauermann via Guix-patches via @ 2021-08-04 18:41 UTC (permalink / raw)
  To: 49880; +Cc: Thiago Jung Bauermann

GMP 4.3 was released with a bug in the t-scan test which causes it to crash
with a segmentation fault. Backport fix from upstream.

* gnu/packages/commencement.scm (gmp-boot): Apply
gmp-4.3-fix-t-scan-test.patch.
* gnu/packages/patches/gmp-4.3-fix-t-scan-test.patch: New file.
---

Hello,

With this and the previous patch applied, gmp-boot builds successfully
on powerpc64le-linux both in master and core-updates-frozen.

It should also fix the same problem in i686-linux:

https://ci.guix.gnu.org/build/699347/details

 gnu/packages/commencement.scm                 |  4 +++-
 .../patches/gmp-4.3-fix-t-scan-test.patch     | 24 +++++++++++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/gmp-4.3-fix-t-scan-test.patch

diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index ae3f07bc59ef..16eb46d44d77 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -1840,7 +1840,9 @@ ac_cv_c_float_format='IEEE (little-endian)'
               (uri (string-append "mirror://gnu/gmp/gmp-" version
                                   ".tar.gz"))
               (sha256 (base32
-                       "15rwq54fi3s11izas6g985y9jklm3xprfsmym3v1g6xr84bavqvv"))))
+                       "15rwq54fi3s11izas6g985y9jklm3xprfsmym3v1g6xr84bavqvv"))
+              ;; See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60933#c11
+              (patches (search-patches "gmp-4.3-fix-t-scan-test.patch"))))
     (arguments
      (substitute-keyword-arguments (package-arguments gmp)
        ((#:configure-flags gmp-configure-flags)
diff --git a/gnu/packages/patches/gmp-4.3-fix-t-scan-test.patch b/gnu/packages/patches/gmp-4.3-fix-t-scan-test.patch
new file mode 100644
index 000000000000..85b4b666215a
--- /dev/null
+++ b/gnu/packages/patches/gmp-4.3-fix-t-scan-test.patch
@@ -0,0 +1,24 @@
+Testcase fix obtained from upstream at:
+
+https://gmplib.org/repo/gmp/raw-rev/966737bd91ed
+
+# HG changeset patch
+# User Torbjorn Granlund <tege@gmplib.org>
+# Date 1318259187 -7200
+# Node ID 966737bd91ed4cd158ca9730167f70db47442fc1
+# Parent  27913f466a23776215bd9341866e10a50cf61c01
+(check_ref): Fix loop end bound.
+
+diff -r 27913f466a23 -r 966737bd91ed tests/mpz/t-scan.c
+--- a/tests/mpz/t-scan.c	Mon Oct 10 12:06:39 2011 +0200
++++ b/tests/mpz/t-scan.c	Mon Oct 10 17:06:27 2011 +0200
+@@ -79,7 +79,7 @@
+ 
+               for (isize = 0; isize <= size; isize++)
+                 {
+-                  for (oindex = 0; oindex <= numberof (offset); oindex++)
++                  for (oindex = 0; oindex < numberof (offset); oindex++)
+                     {
+                       o = offset[oindex];
+                       if ((int) isize*GMP_NUMB_BITS < -o)
+




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

* [bug#49880] [PATCH 2/2] gnu: gmp-boot: Fix t-scan test crash
  2021-08-04 18:41 ` [bug#49880] [PATCH 2/2] gnu: gmp-boot: Fix t-scan test crash Thiago Jung Bauermann via Guix-patches via
@ 2021-08-04 18:51   ` Thiago Jung Bauermann via Guix-patches via
  2021-08-11 21:34   ` [bug#49880] [PATCH 1/2] gnu: gmp-boot: Fix build on powerpc64le-linux Ludovic Courtès
  1 sibling, 0 replies; 5+ messages in thread
From: Thiago Jung Bauermann via Guix-patches via @ 2021-08-04 18:51 UTC (permalink / raw)
  To: 49880

Em quarta-feira, 4 de agosto de 2021, às 15:41:28 -03, Thiago Jung Bauermann escreveu:
> * gnu/packages/commencement.scm (gmp-boot): Apply
> gmp-4.3-fix-t-scan-test.patch.
> * gnu/packages/patches/gmp-4.3-fix-t-scan-test.patch: New file.

Sorry, I just noticed that I forgot to add the new file to local.mk.
Could you please squash this change when applying the patch?

Alternatively, I can send a v2. Whichever you prefer.

* gnu/local.mk (dist_patch_DATA): Add new patch.

diff --git a/gnu/local.mk b/gnu/local.mk
index e8494806fda5..ca8254c22320 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1163,6 +1163,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/glibc-2.28-supported-locales.patch     	\
   %D%/packages/patches/glibc-2.29-supported-locales.patch     	\
   %D%/packages/patches/glibc-supported-locales.patch     	\
+  %D%/packages/patches/gmp-4.3-fix-t-scan-test.patch		\
   %D%/packages/patches/gmp-arm-asm-nothumb.patch		\
   %D%/packages/patches/gmp-faulty-test.patch			\
   %D%/packages/patches/gnash-fix-giflib-version.patch	        \


-- 
Thanks,
Thiago






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

* [bug#49880] [PATCH 1/2] gnu: gmp-boot: Fix build on powerpc64le-linux
  2021-08-04 18:34 [bug#49880] [PATCH 1/2] gnu: gmp-boot: Fix build on powerpc64le-linux Thiago Jung Bauermann via Guix-patches via
  2021-08-04 18:41 ` [bug#49880] [PATCH 2/2] gnu: gmp-boot: Fix t-scan test crash Thiago Jung Bauermann via Guix-patches via
@ 2021-08-11 21:29 ` Ludovic Courtès
  1 sibling, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2021-08-11 21:29 UTC (permalink / raw)
  To: Thiago Jung Bauermann; +Cc: 49880

Hi!

Thiago Jung Bauermann <bauermann@kolabnow.com> skribis:

> Linux on powerpc64 used to run in big-endian mode only.  When support for
> little-endian mode was added around 2014, they took the opportunity to
> update the ELF ABI.  The new ABI is known as ELF ABI v2, and the old one
> retroactively called ELF ABI v1.
>
> GMP 4.3.2 was released in 2010, so its hand-optimized assembly code for
> powerpc64 only support ELF ABI v1.  This causes a build failure on
> powerpc64le-linux, which can be fixed by passing a host triplet with the
> “none” CPU type.  This tells the configure script to use generic C code for
> the build.
>
> * gnu/packages/commencement.scm (gmp-boot)[arguments]{#:configure-flags}: Add
> “--host=none-unknown-linux-gnu” for powerpc64le targets.

[...]

> +     (substitute-keyword-arguments (package-arguments gmp)
> +       ((#:configure-flags gmp-configure-flags)
> +        `(cons* ,@(if (string-prefix? "powerpc64le-" (or (%current-target-system)
> +                                                         (%current-system)))
> +                      ;; The powerpc64 assembly code in this version of GMP
> +                      ;; only supports the ELF ABI v1 but powerpc64le uses ELF
> +                      ;; ABI v2, so use the generic C code instead.  This is
> +                      ;; done by specifying the CPU type as “none”.
> +                      ;;
> +                      ;; According to the manual, “this will run quite slowly,
> +                      ;; but it should be portable and should at least make it
> +                      ;; possible to get something running if all else fails.”
> +                      '("--host=none-unknown-linux-gnu")
> +                      '())
> +                ,gmp-configure-flags))))))

The patch LGTM.  However, could you tweak it so we can apply it on
‘core-updates-frozen’ while not triggering a rebuild on other arches?
Something like:

  (if (string-prefix? …)
      `(cons … ,gmp-configure-flags)
      gmp-configure-flags)

TIA!

Ludo’.




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

* [bug#49880] [PATCH 1/2] gnu: gmp-boot: Fix build on powerpc64le-linux
  2021-08-04 18:41 ` [bug#49880] [PATCH 2/2] gnu: gmp-boot: Fix t-scan test crash Thiago Jung Bauermann via Guix-patches via
  2021-08-04 18:51   ` Thiago Jung Bauermann via Guix-patches via
@ 2021-08-11 21:34   ` Ludovic Courtès
  1 sibling, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2021-08-11 21:34 UTC (permalink / raw)
  To: Thiago Jung Bauermann; +Cc: 49880

Thiago Jung Bauermann <bauermann@kolabnow.com> skribis:

> GMP 4.3 was released with a bug in the t-scan test which causes it to crash
> with a segmentation fault. Backport fix from upstream.
>
> * gnu/packages/commencement.scm (gmp-boot): Apply
> gmp-4.3-fix-t-scan-test.patch.
> * gnu/packages/patches/gmp-4.3-fix-t-scan-test.patch: New file.

Please add the file to gnu/local.mk as well.

> +              ;; See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60933#c11
> +              (patches (search-patches "gmp-4.3-fix-t-scan-test.patch"))))

Comments about the patch should go at the top of the patch, preferably.

So, we could avoid a world rebuild by applying the patch in a
powerpc64le-specific build phase instead of adding it to ‘patches’.

Now, I suppose we’re just lucky that this test hasn’t crashed on other
platforms, aren’t we?  In that case, that would call for applying the
patch (or skipping tests, even) unconditionally, thus triggering a world
rebuild on all arches.

Thoughts?

Ludo’.




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

end of thread, other threads:[~2021-08-11 21:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-04 18:34 [bug#49880] [PATCH 1/2] gnu: gmp-boot: Fix build on powerpc64le-linux Thiago Jung Bauermann via Guix-patches via
2021-08-04 18:41 ` [bug#49880] [PATCH 2/2] gnu: gmp-boot: Fix t-scan test crash Thiago Jung Bauermann via Guix-patches via
2021-08-04 18:51   ` Thiago Jung Bauermann via Guix-patches via
2021-08-11 21:34   ` [bug#49880] [PATCH 1/2] gnu: gmp-boot: Fix build on powerpc64le-linux Ludovic Courtès
2021-08-11 21:29 ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).