Hi Chet,

Building bash from the devel branch fails the link on GNU/Hurd. Here is
the error:

    gcc -L./builtins -L./lib/readline -L./lib/readline -L./lib/glob 
-L./lib/tilde -L./lib/malloc -L./lib/sh  -L./lib/termcap  -g -O2   -o bash 
shell.o eval.o y.tab.o general.o make_cmd.o print_cmd.o dispose_cmd.o 
execute_cmd.o variables.o copy_cmd.o error.o expr.o flags.o jobs.o subst.o 
hashcmd.o hashlib.o mailcheck.o trap.o input.o unwind_prot.o pathexp.o sig.o 
test.o version.o alias.o array.o arrayfunc.o assoc.o braces.o bracecomp.o 
bashhist.o bashline.o  list.o stringlib.o locale.o findcmd.o redir.o 
pcomplete.o pcomplib.o syntax.o xmalloc.o  -lbuiltins -lglob -lsh -lreadline 
-lhistory ./lib/termcap/libtermcap.a -ltilde -lmalloc    -ldl 
    /usr/bin/ld: 
./lib/termcap/libtermcap.a(termcap.o):/home/collin/bash-5.3-rc1/lib/termcap/termcap.c:283:
 multiple definition of `PC'; 
./lib/readline/libreadline.a(terminal.o):/home/collin/bash-5.3-rc1/lib/readline/terminal.c:109:
 first defined here
    /usr/bin/ld: 
./lib/termcap/libtermcap.a(tparam.o):/home/collin/bash-5.3-rc1/lib/termcap/tparam.c:115:
 multiple definition of `BC'; 
./lib/readline/libreadline.a(terminal.o):/home/collin/bash-5.3-rc1/lib/readline/terminal.c:109:
 first defined here
    /usr/bin/ld: 
./lib/termcap/libtermcap.a(tparam.o):/home/collin/bash-5.3-rc1/lib/termcap/tparam.c:116:
 multiple definition of `UP'; 
./lib/readline/libreadline.a(terminal.o):/home/collin/bash-5.3-rc1/lib/readline/terminal.c:109:
 first defined here

I have attached a patch which fixes it. The issue is very simple, just a
missing '#if defined'.

Collin

>From 253559a51dda6c15afbae3174b7b887dede7d9e3 Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.fu...@gmail.com>
Date: Thu, 8 May 2025 22:21:15 -0700
Subject: [PATCH] Fix link error on GNU/Hurd.

* lib/readline/terminal.c (PC, BC, UP) [__gnu_hurd__]: Remove duplicate
declarations.
---
 lib/readline/terminal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/readline/terminal.c b/lib/readline/terminal.c
index 2c70553d..99f63f9c 100644
--- a/lib/readline/terminal.c
+++ b/lib/readline/terminal.c
@@ -102,7 +102,7 @@ static char *term_string_buffer = (char *)NULL;
 
 static int tcap_initialized;
 
-#if !defined (__linux__) && !defined (NCURSES_VERSION)
+#if !(defined (__linux__) || defined (__gnu_hurd__)) && !defined (NCURSES_VERSION)
 #  if defined (__EMX__) || defined (NEED_EXTERN_PC)
 extern 
 #  endif /* __EMX__ || NEED_EXTERN_PC */
-- 
2.49.0

Reply via email to