* [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
* Re: [Buildroot] [PATCH] package/readline: link host shared library against ncurses
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 21:24 ` Arnout Vandecappelle via buildroot
1 sibling, 1 reply; 5+ messages in thread
From: Alexander Sverdlin @ 2026-10-11 8:28 UTC (permalink / raw)
To: Roy Kollen Svendsen, buildroot
Hi Roy,
thanks for looking into this!
I've just stubled upon the same issue, however...
On Tue, 2026-06-02 at 13:47 +0200, Roy Kollen Svendsen wrote:
> 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")
One can argue that the problem was introduced even earlier by commit
baa81362ef ("package/readline: Use configure options to link with ncurses"),
but wasn't triggered until d98e15a3639d...
> 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"
This assumes that host-ncurses always builds the wide variant... Should we
just mimic commit baa81362ef instead? Something like
HOST_READLINE_CONF_ENV = $(READLINE_CONF_ENV)
HOST_READLINE_CONF_OPTS = $(READLINE_CONF_OPTS)
?
> +
> $(eval $(autotools-package))
> $(eval $(host-autotools-package))
--
Alexander Sverdlin.
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Buildroot] [PATCH] package/readline: link host shared library against ncurses
2026-10-11 8:28 ` Alexander Sverdlin
@ 2026-10-11 8:50 ` Thomas Petazzoni via buildroot
2026-10-11 9:15 ` Alexander Sverdlin
0 siblings, 1 reply; 5+ messages in thread
From: Thomas Petazzoni via buildroot @ 2026-10-11 8:50 UTC (permalink / raw)
To: Alexander Sverdlin; +Cc: Roy Kollen Svendsen, buildroot
On Sun, Oct 11, 2026 at 10:28:11AM +0200, Alexander Sverdlin wrote:
> This assumes that host-ncurses always builds the wide variant... Should we
> just mimic commit baa81362ef instead? Something like
>
> HOST_READLINE_CONF_ENV = $(READLINE_CONF_ENV)
> HOST_READLINE_CONF_OPTS = $(READLINE_CONF_OPTS)
I don't have the full context, but doing this is almost always a bad
idea. It easily breaks as people change target variable (CONF_ENV,
CONF_OPTS) without realizing it also affects the host package.
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Buildroot] [PATCH] package/readline: link host shared library against ncurses
2026-10-11 8:50 ` Thomas Petazzoni via buildroot
@ 2026-10-11 9:15 ` Alexander Sverdlin
0 siblings, 0 replies; 5+ messages in thread
From: Alexander Sverdlin @ 2026-10-11 9:15 UTC (permalink / raw)
To: Thomas Petazzoni; +Cc: Roy Kollen Svendsen, buildroot
Hi Thomas,
On Sun, 2026-10-11 at 10:50 +0200, Thomas Petazzoni wrote:
> > This assumes that host-ncurses always builds the wide variant... Should we
> > just mimic commit baa81362ef instead? Something like
> >
> > HOST_READLINE_CONF_ENV = $(READLINE_CONF_ENV)
> > HOST_READLINE_CONF_OPTS = $(READLINE_CONF_OPTS)
>
> I don't have the full context, but doing this is almost always a bad
> idea. It easily breaks as people change target variable (CONF_ENV,
> CONF_OPTS) without realizing it also affects the host package.
we might want to copy-paste both variables as well; in any case, maybe we
want to rely on configure figuring out ncurses deps instead of mangling
configure result on make step.
--
Alexander Sverdlin.
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Buildroot] [PATCH] package/readline: link host shared library against ncurses
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 21:24 ` Arnout Vandecappelle via buildroot
1 sibling, 0 replies; 5+ messages in thread
From: Arnout Vandecappelle via buildroot @ 2026-10-11 21:24 UTC (permalink / raw)
To: Roy Kollen Svendsen, buildroot
Hi Roy,
On 02/06/2026 13:47, Roy Kollen Svendsen wrote:
> readline builds its shared library without linking the curses/termcap
> library, so termcap symbols (UP, BC, PC) are left undefined.
We can achieve the same, I think, by setting
HOST_READLINE_CONF_OPTS = --with-curses --with-shared-termcap-library
(which is what we do on the target). That would be much simpler and more
understandle.
Regards,
Arnout
> 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))
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [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.