summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--gnu/local.mk3
-rw-r--r--gnu/packages/gdb.scm14
-rw-r--r--gnu/packages/patches/gdb-fix-gnu-nat-build.patch61
3 files changed, 75 insertions, 3 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 77f355a76d..ccdc881a88 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -11,7 +11,7 @@
 # Copyright © 2016 Ben Woodcroft <donttrustben@gmail.com>
 # Copyright © 2016, 2017, 2018, 2019 Alex Vong <alexvong1995@gmail.com>
 # Copyright © 2016, 2017, 2018, 2019, 2020, 2021 Efraim Flashner <efraim@flashner.co.il>
-# Copyright © 2016, 2017, 2018, 2019, 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+# Copyright © 2016, 2017, 2018, 2019, 2020, 2021 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
 # Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
 # Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org>
 # Copyright © 2017, 2020 Mathieu Othacehe <m.othacehe@gmail.com>
@@ -1108,6 +1108,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/gd-fix-tests-on-i686.patch		\
   %D%/packages/patches/gd-brect-bounds.patch			\
   %D%/packages/patches/gd-Revert-fix-303-gdlib.pc.patch		\
+  %D%/packages/patches/gdb-fix-gnu-nat-build.patch		\
   %D%/packages/patches/gdm-default-session.patch		\
   %D%/packages/patches/gdm-elogind-support.patch		\
   %D%/packages/patches/gdm-remove-hardcoded-xwayland-path.patch	\
diff --git a/gnu/packages/gdb.scm b/gnu/packages/gdb.scm
index 9036d496a3..aa9e479e46 100644
--- a/gnu/packages/gdb.scm
+++ b/gnu/packages/gdb.scm
@@ -4,7 +4,7 @@
 ;;; Copyright © 2015, 2016, 2019, 2021 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
 ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
-;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+;;; Copyright © 2020, 2021 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2020, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -71,6 +71,12 @@
                                        "gdbsupport/pathstuff.cc")
                           (("\"/bin/sh\"")
                            (format #f "~s" sh))))))
+                  ,@(if (hurd-target?)
+                        '((add-after 'unpack 'patch-gdb/hurd
+                            (lambda* (#:key inputs #:allow-other-keys)
+                              (let ((patch (assoc-ref inputs "hurd-build.patch")))
+                                (invoke "patch" "-p1" "--force" "-i" patch)))))
+                        '())
                   (add-after 'configure 'post-configure
                     (lambda _
                       (for-each patch-makefile-SHELL
@@ -111,7 +117,11 @@
        ("libxml2" ,libxml2)
 
        ;; The Hurd needs -lshouldbeinlibc.
-       ,@(if (hurd-target?) `(("hurd" ,hurd)) '())))
+       ,@(if (hurd-target?)
+             `(("hurd" ,hurd)
+               ("hurd-build.patch"
+                ,(search-patch "gdb-fix-gnu-nat-build.patch")))
+             '())))
     (native-inputs
      `(("texinfo" ,texinfo)
        ("dejagnu" ,dejagnu)
diff --git a/gnu/packages/patches/gdb-fix-gnu-nat-build.patch b/gnu/packages/patches/gdb-fix-gnu-nat-build.patch
new file mode 100644
index 0000000000..dc1ae841b7
--- /dev/null
+++ b/gnu/packages/patches/gdb-fix-gnu-nat-build.patch
@@ -0,0 +1,61 @@
+Fix build on the Hurd.
+
+Patch taken from upstream
+
+    https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=a1700a3199d31910b87cd7db3c394ddd091cfcde
+
+From a1700a3199d31910b87cd7db3c394ddd091cfcde Mon Sep 17 00:00:00 2001
+From: Simon Marchi <simon.marchi@polymtl.ca>
+Date: Wed, 3 Nov 2021 15:09:19 -0400
+Subject: [PATCH] gdb: fix gnu-nat build
+Content-Transfer-Encoding: 8bit
+Content-Type: text/plain; charset=UTF-8
+
+When building gnu-nat.c, we get:
+
+      CXX    gnu-nat.o
+    gnu-nat.c: In member function 'virtual void gnu_nat_target::create_inferior(const char*, const string&, char**, int)':
+    gnu-nat.c:2117:13: error: 'struct inf' has no member named 'target_is_pushed'
+     2117 |   if (!inf->target_is_pushed (this))
+          |             ^~~~~~~~~~~~~~~~
+    gnu-nat.c:2118:10: error: 'struct inf' has no member named 'push_target'
+     2118 |     inf->push_target (this);
+          |          ^~~~~~~~~~~
+
+This is because of a confusion between the generic `struct inferior`
+variable and the gnu-nat-specific `struct inf` variable.  Fix by
+referring to `inferior`, not `inf`.
+
+Adjust the comment on top of `struct inf` to clarify the purpose of that
+type.
+
+Co-Authored-By: Andrea Monaco <andrea.monaco@autistici.org>
+Change-Id: I2fe2f7f6ef61a38d79860fd262b08835c963fc77
+---
+ gdb/gnu-nat.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
+index 54838347f94..c6cecff0686 100644
+--- a/gdb/gnu-nat.c
++++ b/gdb/gnu-nat.c
+@@ -149,7 +149,7 @@ struct inf_wait
+     int suppress;		/* Something trivial happened.  */
+   };
+ 
+-/* The state of an inferior.  */
++/* Further Hurd-specific state of an inferior.  */
+ struct inf
+   {
+     /* Fields describing the current inferior.  */
+@@ -2108,8 +2108,8 @@ gnu_nat_target::create_inferior (const char *exec_file,
+ 
+   inf_debug (inf, "creating inferior");
+ 
+-  if (!inf->target_is_pushed (this))
+-    inf->push_target (this);
++  if (!inferior->target_is_pushed (this))
++    inferior->push_target (this);
+ 
+   pid = fork_inferior (exec_file, allargs, env, gnu_ptrace_me,
+ 		       NULL, NULL, NULL, NULL);