From: Alexander Sverdlin <alexander.sverdlin@gmail.com>
To: Roy Kollen Svendsen <roykollensvendsen@gmail.com>,
buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH] package/readline: link host shared library against ncurses
Date: Sun, 11 Oct 2026 10:28:11 +0200 [thread overview]
Message-ID: <8006a4ffe97e560506b5e7dfa8634f18dceaae6b.camel@gmail.com> (raw)
In-Reply-To: <20260602114732.1957638-1-roykollensvendsen@gmail.com>
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
next prev parent reply other threads:[~2026-10-11 8:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8006a4ffe97e560506b5e7dfa8634f18dceaae6b.camel@gmail.com \
--to=alexander.sverdlin@gmail.com \
--cc=buildroot@buildroot.org \
--cc=roykollensvendsen@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.