Subject: [PATCH core-packages-team 0/5] Restoring the Hurd

From: [email-masked]
Date: Sat, 17 May 2025 16:53:39 +0200 (CEST)

Hello,

Here are (hopefully) the last remaining patches to fix #77709.
I have built things up to bison and automake succesfully.
Some notes:
I am bad at naming things and labelled the glibc patches according to the gnulib-test they fix.

I tried to add comments explaining why things are changed, I hope they are clear enough.

In the pthread-once patch I removed the note from the debian patch regarding the symbol version of pthread-once because as soon as glibc 2.42 is available in guix everything will be built against the 2.42 symbol automatically.

For the --disable-year2038 changes, several packages in commencement.scm already have it unconditionally and this is now repeated twice on i586-gnu by inheriting the args.
Is there a better way to get only the 32bit hurd target than the

(and (target-hurd?)
     (not (target64bit?)))

i am using currently?

I dont know what the convention is when the #:configure-flag keyword is added only for a specific target if the keyword is also spliced in or not, but this is only a cosmetic change.

The automake test suite seems to be extremely flaky. It fails when the host glibc is 2.39 because of locale errors on stderr  (the test checks for empty stderr)  and some other tests that required multiple tries (~8) to get lucky. 
However the t/output-order.sh failure due to libgc warnings from the guile driver on stderr currently on master no longer occurs.

Ludovic also mentioned to merge glibc and glibc/hurd again.

Yelninei (5):
  gnu: glibc/hurd: Fix gnulib tests.
  gnu: findutils: Disable 64bit time_t on the 32bit Hurd.
  gnu: util-linux: Disable 64bit time_t on the 32bit Hurd.
  gnu: tar: Disable 64bit time_t on the 32bit Hurd.
  gnu: bison: Link with pthread on the Hurd.

gnu/local.mk                                  |   3 +
gnu/packages/base.scm                         |  13 ++
gnu/packages/bison.scm                        |  10 +-
gnu/packages/commencement.scm                 |   3 +-
gnu/packages/linux.scm                        |   7 +-
.../glibc-hurd-2.41-pthread-once.patch        | 185 ++++++++++++++++++
.../glibc-hurd-2.41-pthread-sigmask.patch     |  22 +++
.../patches/glibc-hurd-2.41-symlink.patch     |  32 +++
8 files changed, 271 insertions(+), 4 deletions(-)
create mode 100644 gnu/packages/patches/glibc-hurd-2.41-pthread-once.patch
create mode 100644 gnu/packages/patches/glibc-hurd-2.41-pthread-sigmask.patch
create mode 100644 gnu/packages/patches/glibc-hurd-2.41-symlink.patch

base-commit: 4935a8066168c3efc0520d132b6c6a3116eb5d54

>From e4eb684121af05a6b5ee05ba41368c30e1f3f98d Mon Sep 17 00:00:00 2001
Message-ID: <[email-masked]>
In-Reply-To: <[email-masked]>
References: <[email-masked]>
From: Yelninei <[email-masked]>
Date: Fri, 16 May 2025 08:28:07 +0000
Subject: [PATCH core-packages-team 1/5] gnu: glibc/hurd: Fix gnulib tests.

With glibc-2.41 several gnulib tests are failing on the Hurd in multiple core packages
- test-once1
- test-pthread_sigmask1
- test-symlink/test-symlinkat

This adds the relevant patches from glibc upstream or the version from the
debian glibc adapted for glibc 2.41.

* gnu/packages/patches/glibc-hurd-2.41-pthread-once.patch: New patch.
* gnu/packages/patches/glibc-hurd-2.41-pthread-sigmask.patch: New patch.
* gnu/packages/patches/glibc-hurd-2.41-symlink.patch: New patch.
* gnu/packages/base.scm (glibc/hurd): Add them.
* gnu/local.mk : Register them.

Change-Id: I90ec984757da54ebbc7cb7817de00f2876f4a81a
---
 gnu/local.mk                                  |   3 +
 gnu/packages/base.scm                         |   3 +
 .../glibc-hurd-2.41-pthread-once.patch        | 185 ++++++++++++++++++
 .../glibc-hurd-2.41-pthread-sigmask.patch     |  22 +++
 .../patches/glibc-hurd-2.41-symlink.patch     |  32 +++
 5 files changed, 245 insertions(+)
 create mode 100644 gnu/packages/patches/glibc-hurd-2.41-pthread-once.patch
 create mode 100644 gnu/packages/patches/glibc-hurd-2.41-pthread-sigmask.patch
 create mode 100644 gnu/packages/patches/glibc-hurd-2.41-symlink.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index d9bac43edd9..7bd44a97765 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1475,6 +1475,9 @@ dist_patch_DATA =						\
   %D%/packages/patches/glibc-hurd-mach-print.patch		\
   %D%/packages/patches/glibc-hurd-pthread_setcancelstate.patch	\
   %D%/packages/patches/glibc-hurd-signal-sa-siginfo.patch	\
+  %D%/packages/patches/glibc-hurd-2.41-pthread-once.patch	\
+  %D%/packages/patches/glibc-hurd-2.41-pthread-sigmask.patch	\
+  %D%/packages/patches/glibc-hurd-2.41-symlink.patch		\
   %D%/packages/patches/glibc-hurd64-gcc-14.2-tls-bug.patch	\
   %D%/packages/patches/glibc-hurd64-intr-msg-clobber.patch	\
   %D%/packages/patches/glibc-ldd-powerpc.patch			\
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 7187d673430..d6f7d35ced5 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -1664,6 +1664,9 @@ (define-public glibc/hurd
        (patches
         (append (origin-patches (package-source glibc))
                 (search-patches "glibc-hurd-pthread_setcancelstate.patch"
+                                "glibc-hurd-2.41-pthread-once.patch"
+                                "glibc-hurd-2.41-pthread-sigmask.patch"
+                                "glibc-hurd-2.41-symlink.patch"
                                 "glibc-hurd64-intr-msg-clobber.patch"
                                 "glibc-hurd64-gcc-14.2-tls-bug.patch")))))))
 
diff --git a/gnu/packages/patches/glibc-hurd-2.41-pthread-once.patch b/gnu/packages/patches/glibc-hurd-2.41-pthread-once.patch
new file mode 100644
index 00000000000..ba345b361e5
--- /dev/null
+++ b/gnu/packages/patches/glibc-hurd-2.41-pthread-once.patch
@@ -0,0 +1,185 @@
+Taken from:
+https://salsa.debian.org/glibc-team/glibc/-/blob/22f0a9381fe844a5de92a57012833bec225a9686/debian/patches/hurd-i386/local-pthread_once.diff
+This is glibc ccdb68e829a31e4cda8339ea0d2dc3e51fb81ba5 adapted for glibc 2.41
+
+Note: compared to upstream, this was changed to exposing pthread_once as version
+2.41.
+
+commit ccdb68e829a31e4cda8339ea0d2dc3e51fb81ba5
+Author: Samuel Thibault <[email-masked]>
+Date:   Sun Mar 2 15:16:45 2025 +0100
+
+    htl: move pthread_once into libc
+
+diff --git a/htl/Makefile b/htl/Makefile
+index 310097914f..603af24ce4 100644
+--- a/htl/Makefile
++++ b/htl/Makefile
+@@ -31,7 +31,6 @@ libpthread-routines := \
+   pt-key-delete \
+   pt-getspecific \
+   pt-setspecific \
+-  pt-once \
+   pt-alloc \
+   pt-create \
+   pt-getattr \
+@@ -186,6 +185,7 @@ routines := \
+   pt-mutexattr-setrobust \
+   pt-mutexattr-settype \
+   pt-nthreads \
++  pt-once \
+   pt-pthread_self \
+   pt-self pt-equal \
+   pt-setschedparam \
+diff --git a/htl/Versions b/htl/Versions
+index 3d2cb4e7a4..a07a3b3708 100644
+--- a/htl/Versions
++++ b/htl/Versions
+@@ -63,6 +63,7 @@ libc {
+     pthread_mutexattr_setprotocol;
+     pthread_mutexattr_setpshared;
+     pthread_mutexattr_settype;
++    pthread_once;
+     pthread_sigmask;
+   }
+ 
+@@ -158,6 +159,7 @@ libc {
+     pthread_mutexattr_setpshared;
+     pthread_mutexattr_setrobust; pthread_mutexattr_setrobust_np;
+     pthread_mutexattr_settype;
++    pthread_once;
+     pthread_sigmask;
+   }
+ 
+@@ -211,6 +213,7 @@ libc {
+     __pthread_mutexattr_destroy;
+     __pthread_mutexattr_init;
+     __pthread_mutexattr_settype;
++    __pthread_once;
+     __pthread_sigstate;
+     __pthread_sigstate_destroy;
+     __pthread_sigmask;
+@@ -264,8 +267,6 @@ libpthread {
+     pthread_mutex_timedlock; pthread_mutex_transfer_np;
+     pthread_mutex_trylock; pthread_mutex_unlock;
+ 
+-    pthread_once;
+-
+     pthread_rwlock_destroy; pthread_rwlock_init; pthread_rwlock_rdlock;
+     pthread_rwlock_timedrdlock; pthread_rwlock_timedwrlock;
+     pthread_rwlock_tryrdlock; pthread_rwlock_trywrlock;
+diff --git a/sysdeps/htl/libc-lockP.h b/sysdeps/htl/libc-lockP.h
+index 5085570baa..092eb35831 100644
+--- a/sysdeps/htl/libc-lockP.h
++++ b/sysdeps/htl/libc-lockP.h
+@@ -114,6 +114,7 @@ libc_hidden_proto (__pthread_rwlock_unlock)
+ 
+ extern int __pthread_once (pthread_once_t *__once_control,
+ 			   void (*__init_routine) (void));
++libc_hidden_proto (__pthread_once);
+ 
+ extern int __pthread_atfork (void (*__prepare) (void),
+ 			     void (*__parent) (void),
+@@ -128,7 +129,6 @@ libc_hidden_proto (__pthread_setcancelstate)
+ weak_extern (__pthread_key_create)
+ weak_extern (__pthread_setspecific)
+ weak_extern (__pthread_getspecific)
+-weak_extern (__pthread_once)
+ weak_extern (__pthread_initialize)
+ weak_extern (__pthread_atfork)
+ weak_extern (__pthread_setcancelstate)
+@@ -128,7 +129,6 @@ libc_hidden_proto (__pthread_setcancelstate)
+ #  pragma weak __pthread_key_create
+ #  pragma weak __pthread_setspecific
+ #  pragma weak __pthread_getspecific
+-#  pragma weak __pthread_once
+ #  pragma weak __pthread_initialize
+ #  pragma weak __pthread_atfork
+ #  pragma weak __pthread_setcancelstate
+diff --git a/sysdeps/htl/pt-once.c b/sysdeps/htl/pt-once.c
+index 68fb2e1129..1f999ce492 100644
+--- a/sysdeps/htl/pt-once.c
++++ b/sysdeps/htl/pt-once.c
+@@ -20,6 +20,7 @@
+ #include <atomic.h>
+ 
+ #include <pt-internal.h>
++#include <shlib-compat.h>
+ 
+ static void
+ clear_once_control (void *arg)
+@@ -53,4 +54,9 @@ __pthread_once (pthread_once_t *once_control, void (*init_routine) (void))
+ 
+   return 0;
+ }
+-weak_alias (__pthread_once, pthread_once);
++libc_hidden_def (__pthread_once)
++versioned_symbol (libc, __pthread_once, pthread_once, GLIBC_2_41);
++
++#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_41)
++compat_symbol (libpthread, __pthread_once, pthread_once, GLIBC_2_12);
++#endif
+diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
+index bf62539c57..461df01ffb 100644
+--- a/sysdeps/mach/hurd/i386/libc.abilist
++++ b/sysdeps/mach/hurd/i386/libc.abilist
+@@ -88,6 +88,7 @@ GLIBC_2.12 pthread_mutexattr_setprioceiling F
+ GLIBC_2.12 pthread_mutexattr_setprotocol F
+ GLIBC_2.12 pthread_mutexattr_setpshared F
+ GLIBC_2.12 pthread_mutexattr_settype F
++GLIBC_2.12 pthread_once F
+ GLIBC_2.12 pthread_self F
+ GLIBC_2.12 pthread_setschedparam F
+ GLIBC_2.12 pthread_sigmask F
+@@ -2595,6 +2596,7 @@ GLIBC_2.42 pthread_mutex_consistent_np F
+ GLIBC_2.41 pthread_mutexattr_setrobust F
+ GLIBC_2.41 pthread_mutexattr_setrobust_np F
+ GLIBC_2.41 pthread_mutexattr_settype F
++GLIBC_2.41 pthread_once F
+ GLIBC_2.41 pthread_sigmask F
+ GLIBC_2.5 __readlinkat_chk F
+ GLIBC_2.5 inet6_opt_append F
+diff --git a/sysdeps/mach/hurd/i386/libpthread.abilist b/sysdeps/mach/hurd/i386/libpthread.abilist
+index d9c1a1790a..b067d377b3 100644
+--- a/sysdeps/mach/hurd/i386/libpthread.abilist
++++ b/sysdeps/mach/hurd/i386/libpthread.abilist
+@@ -35,7 +35,6 @@ GLIBC_2.12 pthread_key_create F
+ GLIBC_2.12 pthread_mutex_transfer_np F
+ GLIBC_2.12 pthread_mutex_trylock F
+ GLIBC_2.12 pthread_mutex_unlock F
+-GLIBC_2.12 pthread_once F
+ GLIBC_2.12 pthread_rwlock_destroy F
+ GLIBC_2.12 pthread_rwlock_init F
+ GLIBC_2.12 pthread_rwlock_rdlock F
+diff --git a/sysdeps/mach/hurd/x86_64/libc.abilist b/sysdeps/mach/hurd/x86_64/libc.abilist
+index fb068ab45e..6f235d20ba 100644
+--- a/sysdeps/mach/hurd/x86_64/libc.abilist
++++ b/sysdeps/mach/hurd/x86_64/libc.abilist
+@@ -1579,6 +1579,7 @@ GLIBC_2.38 pthread_mutexattr_setpshared F
+ GLIBC_2.38 pthread_mutexattr_setrobust F
+ GLIBC_2.38 pthread_mutexattr_setrobust_np F
+ GLIBC_2.38 pthread_mutexattr_settype F
++GLIBC_2.38 pthread_once F
+ GLIBC_2.38 pthread_self F
+ GLIBC_2.38 pthread_setcancelstate F
+ GLIBC_2.38 pthread_setcanceltype F
+@@ -2278,6 +2279,7 @@ GLIBC_2.42 pthread_mutex_consistent_np F
+ GLIBC_2.41 pthread_mutexattr_setrobust F
+ GLIBC_2.41 pthread_mutexattr_setrobust_np F
+ GLIBC_2.41 pthread_mutexattr_settype F
++GLIBC_2.41 pthread_once F
+ GLIBC_2.41 pthread_sigmask F
+ HURD_CTHREADS_0.3 __cthread_getspecific F
+ HURD_CTHREADS_0.3 __cthread_keycreate F
+diff --git a/sysdeps/mach/hurd/x86_64/libpthread.abilist b/sysdeps/mach/hurd/x86_64/libpthread.abilist
+index 71ce1d6288..6b8acec832 100644
+--- a/sysdeps/mach/hurd/x86_64/libpthread.abilist
++++ b/sysdeps/mach/hurd/x86_64/libpthread.abilist
+@@ -55,7 +55,6 @@ GLIBC_2.38 pthread_key_create F
+ GLIBC_2.38 pthread_mutex_transfer_np F
+ GLIBC_2.38 pthread_mutex_trylock F
+ GLIBC_2.38 pthread_mutex_unlock F
+-GLIBC_2.38 pthread_once F
+ GLIBC_2.38 pthread_rwlock_clockrdlock F
+ GLIBC_2.38 pthread_rwlock_clockwrlock F
+ GLIBC_2.38 pthread_rwlock_destroy F
diff --git a/gnu/packages/patches/glibc-hurd-2.41-pthread-sigmask.patch b/gnu/packages/patches/glibc-hurd-2.41-pthread-sigmask.patch
new file mode 100644
index 00000000000..4c65ddbd53b
--- /dev/null
+++ b/gnu/packages/patches/glibc-hurd-2.41-pthread-sigmask.patch
@@ -0,0 +1,22 @@
+Taken from:
+https://salsa.debian.org/glibc-team/glibc/-/blob/6c823b5862bd91ca757eeb9c6f5326875bc8af01/debian/patches/hurd-i386/git-pthread_sigmask_nothread.diff
+
+Upstream 2.42 has a much more involved cleanup fix which in the end
+boils down to this.
+
+Index: glibc-upstream/sysdeps/mach/hurd/htl/pt-sigstate.c
+===================================================================
+--- glibc-upstream.orig/sysdeps/mach/hurd/htl/pt-sigstate.c
++++ glibc-upstream/sysdeps/mach/hurd/htl/pt-sigstate.c
+@@ -36,7 +36,10 @@ __pthread_sigstate (struct __pthread *th
+   if (set != NULL)
+     new = *set;
+ 
+-  ss = _hurd_thread_sigstate (thread->kernel_thread);
++  if (thread == _pthread_self ())
++    ss = _hurd_self_sigstate ();
++  else
++    ss = _hurd_thread_sigstate (thread->kernel_thread);
+   assert (ss);
+ 
+   _hurd_sigstate_lock (ss);
diff --git a/gnu/packages/patches/glibc-hurd-2.41-symlink.patch b/gnu/packages/patches/glibc-hurd-2.41-symlink.patch
new file mode 100644
index 00000000000..8b106ca0a45
--- /dev/null
+++ b/gnu/packages/patches/glibc-hurd-2.41-symlink.patch
@@ -0,0 +1,32 @@
+Taken from:
+https://sourceware.org/git/?p=glibc.git;a=patch;h=39183b953c68a489cc0b9aefb8974711c834fb38
+
+From 39183b953c68a489cc0b9aefb8974711c834fb38 Mon Sep 17 00:00:00 2001
+From: Samuel Thibault <[email-masked]>
+Date: Mon, 21 Apr 2025 22:21:17 +0200
+Subject: [PATCH] hurd: Make symlink return EEXIST on existing target directory
+
+8ef17919509e ("hurd: Fix EINVAL error on linking to a slash-trailing path
+[BZ #32569]) made symlink return ENOTDIR, but the gnulib testsuite does
+not recognize it for such a situation, and EEXIST is indeed more
+comprehensible to users.
+---
+ sysdeps/mach/hurd/symlinkat.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/sysdeps/mach/hurd/symlinkat.c b/sysdeps/mach/hurd/symlinkat.c
+index e7dfb673df..cb6250e6f0 100644
+--- a/sysdeps/mach/hurd/symlinkat.c
++++ b/sysdeps/mach/hurd/symlinkat.c
+@@ -47,7 +47,7 @@ __symlinkat (const char *from, int fd, const char *to)
+ 
+   if (! *name)
+     /* Can't link to the existing directory itself.  */
+-    err = ENOTDIR;
++    err = EEXIST;
+   else
+     /* Create a new, unlinked node in the target directory.  */
+     err = __dir_mkfile (dir, O_WRITE, 0777 & ~_hurd_umask, &node);
+-- 
+2.49.0
+
-- 
2.49.0

>From 1d760ed8f854ec9216636a21687c38fc484bb02b Mon Sep 17 00:00:00 2001
Message-ID: <[email-masked]>
In-Reply-To: <[email-masked]>
References: <[email-masked]>
From: Yelninei <[email-masked]>
Date: Sun, 11 May 2025 12:25:04 +0000
Subject: [PATCH core-packages-team 2/5] gnu: findutils: Disable 64bit time_t
 on the 32bit Hurd.

* gnu/packages/base.scm (findutils): Add --disable-year2038 configure-flag for
32bit hurd.

Change-Id: I724f9e2807830d4b028a385e5e7c1f0d2e47e707
---
 gnu/packages/base.scm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index d6f7d35ced5..2228c1064c9 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -449,6 +449,11 @@ (define-public findutils
    (build-system gnu-build-system)
    (arguments
     `(#:configure-flags (list
+                         ;; XXX: 32-bit Hurd platforms don't support 64bit time_t
+                         ,@(if (and (target-hurd?)
+                                    (not (target-64bit?)))
+                               '("--disable-year2038")
+                               '())
                          ;; Tell 'updatedb' to write to /var.
                          "--localstatedir=/var")
       #:phases (modify-phases %standard-phases
-- 
2.49.0

>From 91073aecd19e45a68ab995342111eb36d63ce0bf Mon Sep 17 00:00:00 2001
Message-ID: <[email-masked]>
In-Reply-To: <[email-masked]>
References: <[email-masked]>
From: Yelninei <[email-masked]>
Date: Sun, 11 May 2025 12:20:43 +0000
Subject: [PATCH core-packages-team 3/5] gnu: util-linux: Disable 64bit time_t
 on the 32bit Hurd.

* gnu/packages/linux.scm (util-linux): Add --disable-year2038 configure-flag for
32bit hurd.
Change-Id: I5637bb9bf3c02759c7c9ed85c1f0bdf93bf03352

Change-Id: I387dc1559041956874c756d53382e5c8addf8202
---
 gnu/packages/linux.scm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 2822b491639..929c62e4bdc 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -2706,7 +2706,12 @@ (define-public util-linux
                    ;; Install completions where our bash-completion package
                    ;; expects them.
                    (string-append "--with-bashcompletiondir=" #$output
-                                  "/etc/bash_completion.d"))
+                                  "/etc/bash_completion.d")
+                   ;; XXX: 32-bit Hurd platforms don't support 64bit time_t
+                   #$@(if (and (target-hurd?)
+                               (not (target-64bit?)))
+                          '("--disable-year2038")
+                          '()))
 
            ;; FIXME: For now we cannot reliably run tests on GNU/Hurd:
            ;; <https://bugs.gnu.org/47791>.
-- 
2.49.0

>From 75d3c09f33e8141de2fd8c10dedee55d0a95e75a Mon Sep 17 00:00:00 2001
Message-ID: <[email-masked]>
In-Reply-To: <[email-masked]>
References: <[email-masked]>
From: Yelninei <[email-masked]>
Date: Sun, 11 May 2025 12:25:16 +0000
Subject: [PATCH core-packages-team 4/5] gnu: tar: Disable 64bit time_t on the
 32bit Hurd.

* gnu/packages/base.scm (tar): Add --disable-year2038 configure-flag for
32bit hurd.
Change-Id: I8573dca7fa848afb968365977c49edbd01e97756

Change-Id: Ie3ab2f7275c9d7163557a8874f7b004dae3c6a17
---
 gnu/packages/base.scm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 2228c1064c9..b371646204e 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -268,6 +268,11 @@ (define-public tar
           ((not (target-64bit?))
            '(#:make-flags (list "TESTSUITEFLAGS= -k '!tricky time stamps'")))
           (else '()))
+      ;; XXX: 32-bit Hurd platforms don't support 64bit time_t
+      ,@(if (and (target-hurd?)
+                 (not (target-64bit?)))
+            (list #:configure-flags ''("--disable-year2038"))
+            '())
       #:phases (modify-phases %standard-phases
                  (add-before 'build 'set-shell-file-name
                    (lambda* (#:key inputs #:allow-other-keys)
-- 
2.49.0

>From 3730d78b3ec57e7fe281d5dd69628e7047203ed3 Mon Sep 17 00:00:00 2001
Message-ID: <[email-masked]>
In-Reply-To: <[email-masked]>
References: <[email-masked]>
From: Yelninei <[email-masked]>
Date: Mon, 12 May 2025 16:09:00 +0000
Subject: [PATCH core-packages-team 5/5] gnu: bison: Link with pthread on the
 Hurd.

* gnu/packages/bison.scm (bison): Add LIBS=-lphtread on the Hurd.
* gnu/packages/commencement.scm (bison-boot0): Strip configure-flags.

Change-Id: If47c10c3a653df5fd07119a6fa53a40527d37b56
---
 gnu/packages/bison.scm        | 10 ++++++++--
 gnu/packages/commencement.scm |  3 ++-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/bison.scm b/gnu/packages/bison.scm
index 6cd7abe4206..feca0743048 100644
--- a/gnu/packages/bison.scm
+++ b/gnu/packages/bison.scm
@@ -24,6 +24,7 @@ (define-module (gnu packages bison)
   #:use-module (guix licenses)
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix utils)
   #:use-module (guix build-system gnu)
   #:use-module (gnu packages m4)
   #:use-module (gnu packages perl)
@@ -44,14 +45,19 @@ (define-public bison
         "1wjvbbzrr16k1jlby3l436an3kvv492h08arbnf0gwgprha05flv"))))
     (build-system gnu-build-system)
     (arguments
-     '(;; Building in parallel on many-core systems may cause an error such as
+     `(;; Building in parallel on many-core systems may cause an error such as
        ;; "mv: cannot stat 'examples/c/reccalc/scan.stamp.tmp': No such file or
        ;; directory".  See <https://bugs.gnu.org/36238>.
        #:parallel-build? #f
        ;; Similarly, when building tests in parallel, Make may produce this error:
        ;; "./examples/c/reccalc/scan.l:13:10: fatal error: parse.h: No such file
        ;; or directory".  Full log in <https://bugs.gnu.org/36238>.
-       #:parallel-tests? #f))
+       #:parallel-tests? #f
+       ;; On the Hurd with glibc 2.41 bison uses weak symbols from pthread
+       ;; but does not link to it.
+       ,@(if (target-hurd?)
+             (list #:configure-flags ''("LIBS=-lpthread"))
+             '())))
     (native-inputs (list perl
                          ;; m4 is not present in PATH when cross-building.
                          m4))
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index edd4a1db468..1ffb72945a1 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -2639,7 +2639,8 @@ (define bison-boot0
            (_
             '(#:configure-flags '("gl_cv_func_posix_spawn_works=no"))))
 
-       ,@(package-arguments bison)))))
+       ,@(strip-keyword-arguments '(#:configure-flags)
+				  (package-arguments bison))))))
 
 (define flex-boot0
   ;; This Flex is needed to build MiG as well as Linux-Libre headers.
-- 
2.49.0