All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/readline: link host shared library against ncurses
@ 2026-06-02 11:47 Roy Kollen Svendsen
  2026-10-11  8:28 ` Alexander Sverdlin
  2026-10-11 21:24 ` Arnout Vandecappelle via buildroot
  0 siblings, 2 replies; 5+ messages in thread
From: Roy Kollen Svendsen @ 2026-06-02 11:47 UTC (permalink / raw)
  To: buildroot; +Cc: Roy Kollen Svendsen

readline builds its shared library without linking the curses/termcap
library, so termcap symbols (UP, BC, PC) are left undefined.

host-gdb pulls in host-readline, installing this libreadline.so into the
host directory. buildroot runs its fakeroot finalization script with
/bin/sh, and fakeroot puts $(HOST_DIR)/lib in LD_LIBRARY_PATH; so when
/bin/sh is linked against readline (e.g. bash) it loads this host
libreadline.so rather than the system one, and because UP is a data
symbol the loader aborts before /bin/sh can start:

  /bin/sh: symbol lookup error: libreadline.so.8: undefined symbol: UP

This only happens when the host's /bin/sh links readline and host-gdb is
enabled; otherwise the host libreadline.so is never loaded, which is why
it is not seen on every build host.

Pass SHLIB_LIBS so readline's own build links the host shared library
against the libncursesw that host-ncurses already provides (it carries
the termcap symbols), making the host libreadline.so self-contained.
Only the host library is changed: the target library is never loaded
during the build, so it cannot break image generation.

Fixes: d98e15a3639d ("package/gdb: really fix build with GCC 15.x by using external readline")
Signed-off-by: Roy Kollen Svendsen <roykollensvendsen@gmail.com>
---
 package/readline/readline.mk | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/package/readline/readline.mk b/package/readline/readline.mk
index f69cbe45e2..99d3711e7b 100644
--- a/package/readline/readline.mk
+++ b/package/readline/readline.mk
@@ -30,5 +30,14 @@ define READLINE_INSTALL_INPUTRC
 endef
 READLINE_POST_INSTALL_TARGET_HOOKS += READLINE_INSTALL_INPUTRC
 
+# readline does not link its shared library against the curses/termcap
+# library, leaving termcap symbols (UP, BC, PC) undefined. fakeroot runs
+# its finalization script with $(HOST_DIR)/lib in LD_LIBRARY_PATH, so a
+# readline-linked /bin/sh loads this host libreadline.so during root
+# filesystem generation and aborts on the undefined symbols. Link it
+# against the libncursesw that host-ncurses provides (it carries those
+# symbols) via readline's SHLIB_LIBS.
+HOST_READLINE_MAKE_OPTS += SHLIB_LIBS="-L$(HOST_DIR)/lib -lncursesw"
+
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))
-- 
2.54.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-10-13 17:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-02 11:47 [Buildroot] [PATCH] package/readline: link host shared library against ncurses Roy Kollen Svendsen
2026-10-11  8:28 ` Alexander Sverdlin
2026-10-11  8:50   ` Thomas Petazzoni via buildroot
2026-10-11  9:15     ` Alexander Sverdlin
2026-10-11 21:24 ` Arnout Vandecappelle via buildroot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.