diff mbox series

[bug#49880,1/2] gnu: gmp-boot: Fix build on powerpc64le-linux

Message ID 20210804183454.153783-1-bauermann@kolabnow.com
State Accepted
Headers show
Series [bug#49880,1/2] gnu: gmp-boot: Fix build on powerpc64le-linux | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Thiago Jung Bauermann Aug. 4, 2021, 6:34 p.m. UTC
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(-)

Comments

Ludovic Courtès Aug. 11, 2021, 9:29 p.m. UTC | #1
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’.
diff mbox series

Patch

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