diff mbox series

[bug#68202,5/5] gnu: libsigsegv: Fix building for x86_64-linux-gnux32.

Message ID 8e2a3ae4b8c3088d7c6d857e88b3dd394afb57c6.1704179455.git.efraim@flashner.co.il
State New
Headers show
Series Add support for x86_64-linux-gnux32 | expand

Commit Message

Efraim Flashner Jan. 2, 2024, 7:27 a.m. UTC
* gnu/packages/libsigsegv.scm (libsigsegv)[arguments]: When building for
x86_64-linux-gnux32 add a phase to not include extra headers.

Change-Id: Ie2d23fd037ed533dacf08acf52771b7ab1d446ac
---
 gnu/packages/libsigsegv.scm | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

Comments

Mathieu Othacehe Jan. 3, 2024, 8:43 a.m. UTC | #1
Hello Efraim,

> +      ;; On some architectures 'struct sigcontext' gets redefined from
> +      ;; %linux-libre-headers/include/asm/sigcontext.h
> +      ,@(cond ((target-mips64el?)
> +               `(#:phases (modify-phases %standard-phases
> +                            (add-before 'configure 'patch-mips-old-h
> +                              (lambda _
> +                                (substitute* "src/fault-linux-mips-old.h"
> +                                  (("#include <asm/sigcontext\\.h>") "")))))))
> +              ((target-x32?)
> +               `(#:phases (modify-phases %standard-phases
> +                            (add-before 'configure 'patch-linux-x86_64-old-h
> +                              (lambda _
> +                                (substitute* "src/fault-linux-x86_64-old.h"
> +                                  (("#include <asm/sigcontext\\.h>") "")))))))
> +              (else '()))))
>     (description
>      "GNU libsigsegv is a library to handle page faults, which occur when a
>  program tries to access an unavailable region of memory, in user mode.  By

#67859 is doing more or less the same thing, but for x86_64 as a
whole. Could you maybe replace `target-x32` by `target-x86`?

Maybe we should come up with a list of architectures that need that kind
of fix in libsigsegv and patch all the src/fault-linux-xxx-old-h?

The rest of the series seems fine to me.

Thanks,

Mathieu
Efraim Flashner Jan. 3, 2024, 8:53 a.m. UTC | #2
On Wed, Jan 03, 2024 at 09:43:32AM +0100, Mathieu Othacehe wrote:
> 
> Hello Efraim,
> 
> > +      ;; On some architectures 'struct sigcontext' gets redefined from
> > +      ;; %linux-libre-headers/include/asm/sigcontext.h
> > +      ,@(cond ((target-mips64el?)
> > +               `(#:phases (modify-phases %standard-phases
> > +                            (add-before 'configure 'patch-mips-old-h
> > +                              (lambda _
> > +                                (substitute* "src/fault-linux-mips-old.h"
> > +                                  (("#include <asm/sigcontext\\.h>") "")))))))
> > +              ((target-x32?)
> > +               `(#:phases (modify-phases %standard-phases
> > +                            (add-before 'configure 'patch-linux-x86_64-old-h
> > +                              (lambda _
> > +                                (substitute* "src/fault-linux-x86_64-old.h"
> > +                                  (("#include <asm/sigcontext\\.h>") "")))))))
> > +              (else '()))))
> >     (description
> >      "GNU libsigsegv is a library to handle page faults, which occur when a
> >  program tries to access an unavailable region of memory, in user mode.  By
> 
> #67859 is doing more or less the same thing, but for x86_64 as a
> whole. Could you maybe replace `target-x32` by `target-x86`?
> 
> Maybe we should come up with a list of architectures that need that kind
> of fix in libsigsegv and patch all the src/fault-linux-xxx-old-h?

I don't have a mips machine hooked up so I can't test if its needed
natively. I did check debian's packaging of libsigsegv and they don't
have anything like this for any architecture.  It wouldn't be hard to
change it to (if (%current-target-system)
                ... (substitute* (find-files "src" "fault.*-old\\.h$")
which would hit every instance of this include

> The rest of the series seems fine to me.
> 
> Thanks,
> 
> Mathieu
diff mbox series

Patch

diff --git a/gnu/packages/libsigsegv.scm b/gnu/packages/libsigsegv.scm
index ebbdd2ad90..9f4b0dd88d 100644
--- a/gnu/packages/libsigsegv.scm
+++ b/gnu/packages/libsigsegv.scm
@@ -1,6 +1,6 @@ 
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2012, 2013, 2018 Ludovic Courtès <ludo@gnu.org>
-;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2017, 2024 Efraim Flashner <efraim@flashner.co.il>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -21,6 +21,7 @@  (define-module (gnu packages libsigsegv)
   #:use-module (guix licenses)
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix utils)
   #:use-module (guix build-system gnu))
 
 (define-public libsigsegv
@@ -40,21 +41,21 @@  (define-public libsigsegv
    (arguments
     `(;; The shared library isn't built by default but some packages need it.
       #:configure-flags '("--enable-shared")
-
-      ;; On MIPS, work around this error:
-      ;;
-      ;; In file included from fault-linux-mips-old.h:18:0,
-      ;;    [...]
-      ;; linux-libre-headers-cross-mips64el-linux-gnu-3.3.8/include/asm/sigcontext.h:57:8: error: redefinition of 'struct sigcontext'
-      ,@(if (string-contains (or (%current-target-system) (%current-system))
-                             "mips64el")
-            `(#:phases (modify-phases %standard-phases
-                         (add-before 'configure 'patch-mips-old-h
-                           (lambda _
-                             (substitute* "src/fault-linux-mips-old.h"
-                               (("#include <asm/sigcontext\\.h>") ""))
-                             #t))))
-            '())))
+      ;; On some architectures 'struct sigcontext' gets redefined from
+      ;; %linux-libre-headers/include/asm/sigcontext.h
+      ,@(cond ((target-mips64el?)
+               `(#:phases (modify-phases %standard-phases
+                            (add-before 'configure 'patch-mips-old-h
+                              (lambda _
+                                (substitute* "src/fault-linux-mips-old.h"
+                                  (("#include <asm/sigcontext\\.h>") "")))))))
+              ((target-x32?)
+               `(#:phases (modify-phases %standard-phases
+                            (add-before 'configure 'patch-linux-x86_64-old-h
+                              (lambda _
+                                (substitute* "src/fault-linux-x86_64-old.h"
+                                  (("#include <asm/sigcontext\\.h>") "")))))))
+              (else '()))))
    (description
     "GNU libsigsegv is a library to handle page faults, which occur when a
 program tries to access an unavailable region of memory, in user mode.  By