* [PATCH] kconfig: fix static linking of nconf
@ 2026-01-10 11:48 Arkadiusz Kozdra
2026-01-10 23:20 ` Nathan Chancellor
0 siblings, 1 reply; 4+ messages in thread
From: Arkadiusz Kozdra @ 2026-01-10 11:48 UTC (permalink / raw)
To: linux-kbuild
Cc: Masahiro Yamada, Nathan Chancellor, Nicolas Schier,
Jakub Kicinski, Alex Deucher, Geert Uytterhoeven, Mark Brown,
Sam Ravnborg, Arkadiusz Kozdra
When running make nconfig with a static linking host toolchain,
the libraries are linked in an incorrect order,
resulting in errors similar to the following:
$ MAKEFLAGS='HOSTCC=cc\ -static' make nconfig
/usr/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/14.2.1/../../../../lib64/libpanel.a(p_new.o): in function `new_panel':
(.text+0x13): undefined reference to `_nc_panelhook_sp'
/usr/bin/ld: (.text+0x6c): undefined reference to `_nc_panelhook_sp'
Fixes: 1c5af5cf9308 ("kconfig: refactor ncurses package checks for building mconf and nconf")
Signed-off-by: Arusekk <floss@arusekk.pl>
---
scripts/kconfig/nconf-cfg.sh | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/scripts/kconfig/nconf-cfg.sh b/scripts/kconfig/nconf-cfg.sh
index a20290b1a37d..fedebbd6b2c8 100755
--- a/scripts/kconfig/nconf-cfg.sh
+++ b/scripts/kconfig/nconf-cfg.sh
@@ -6,8 +6,8 @@ set -eu
cflags=$1
libs=$2
-PKG="ncursesw menuw panelw"
-PKG2="ncurses menu panel"
+PKG="menuw panelw ncursesw"
+PKG2="menu panel ncurses"
if [ -n "$(command -v ${HOSTPKG_CONFIG})" ]; then
if ${HOSTPKG_CONFIG} --exists $PKG; then
@@ -28,19 +28,19 @@ fi
# find ncurses by pkg-config.)
if [ -f /usr/include/ncursesw/ncurses.h ]; then
echo -D_GNU_SOURCE -I/usr/include/ncursesw > ${cflags}
- echo -lncursesw -lmenuw -lpanelw > ${libs}
+ echo -lmenuw -lpanelw -lncursesw > ${libs}
exit 0
fi
if [ -f /usr/include/ncurses/ncurses.h ]; then
echo -D_GNU_SOURCE -I/usr/include/ncurses > ${cflags}
- echo -lncurses -lmenu -lpanel > ${libs}
+ echo -lmenu -lpanel -lncurses > ${libs}
exit 0
fi
if [ -f /usr/include/ncurses.h ]; then
echo -D_GNU_SOURCE > ${cflags}
- echo -lncurses -lmenu -lpanel > ${libs}
+ echo -lmenu -lpanel -lncurses > ${libs}
exit 0
fi
--
2.51.2
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] kconfig: fix static linking of nconf
2026-01-10 11:48 [PATCH] kconfig: fix static linking of nconf Arkadiusz Kozdra
@ 2026-01-10 23:20 ` Nathan Chancellor
2026-01-12 13:24 ` Arkadiusz Kozdra
0 siblings, 1 reply; 4+ messages in thread
From: Nathan Chancellor @ 2026-01-10 23:20 UTC (permalink / raw)
To: Arkadiusz Kozdra
Cc: linux-kbuild, Masahiro Yamada, Nicolas Schier, Jakub Kicinski,
Alex Deucher, Geert Uytterhoeven, Mark Brown, Sam Ravnborg
On Sat, Jan 10, 2026 at 12:48:08PM +0100, Arkadiusz Kozdra wrote:
> When running make nconfig with a static linking host toolchain,
> the libraries are linked in an incorrect order,
> resulting in errors similar to the following:
>
> $ MAKEFLAGS='HOSTCC=cc\ -static' make nconfig
> /usr/bin/ld: /usr/lib64/gcc/x86_64-unknown-linux-gnu/14.2.1/../../../../lib64/libpanel.a(p_new.o): in function `new_panel':
> (.text+0x13): undefined reference to `_nc_panelhook_sp'
> /usr/bin/ld: (.text+0x6c): undefined reference to `_nc_panelhook_sp'
>
> Fixes: 1c5af5cf9308 ("kconfig: refactor ncurses package checks for building mconf and nconf")
> Signed-off-by: Arusekk <floss@arusekk.pl>
> ---
> scripts/kconfig/nconf-cfg.sh | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/scripts/kconfig/nconf-cfg.sh b/scripts/kconfig/nconf-cfg.sh
> index a20290b1a37d..fedebbd6b2c8 100755
> --- a/scripts/kconfig/nconf-cfg.sh
> +++ b/scripts/kconfig/nconf-cfg.sh
> @@ -6,8 +6,8 @@ set -eu
> cflags=$1
> libs=$2
>
> -PKG="ncursesw menuw panelw"
> -PKG2="ncurses menu panel"
Is it worth a comment that the order of these packages is intentional to
support static library builds? I do not mind adding after the fact to
save you from sending a v2. I guess this situation is not too common
since 1c5af5cf9308 is over six years old at this point but if any other
dependencies become necessary in the future, it might help folks place
them in the correct order.
> +PKG="menuw panelw ncursesw"
> +PKG2="menu panel ncurses"
>
> if [ -n "$(command -v ${HOSTPKG_CONFIG})" ]; then
> if ${HOSTPKG_CONFIG} --exists $PKG; then
> @@ -28,19 +28,19 @@ fi
> # find ncurses by pkg-config.)
> if [ -f /usr/include/ncursesw/ncurses.h ]; then
> echo -D_GNU_SOURCE -I/usr/include/ncursesw > ${cflags}
> - echo -lncursesw -lmenuw -lpanelw > ${libs}
> + echo -lmenuw -lpanelw -lncursesw > ${libs}
> exit 0
> fi
>
> if [ -f /usr/include/ncurses/ncurses.h ]; then
> echo -D_GNU_SOURCE -I/usr/include/ncurses > ${cflags}
> - echo -lncurses -lmenu -lpanel > ${libs}
> + echo -lmenu -lpanel -lncurses > ${libs}
> exit 0
> fi
>
> if [ -f /usr/include/ncurses.h ]; then
> echo -D_GNU_SOURCE > ${cflags}
> - echo -lncurses -lmenu -lpanel > ${libs}
> + echo -lmenu -lpanel -lncurses > ${libs}
> exit 0
> fi
>
> --
> 2.51.2
>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] kconfig: fix static linking of nconf
2026-01-10 23:20 ` Nathan Chancellor
@ 2026-01-12 13:24 ` Arkadiusz Kozdra
2026-01-14 13:26 ` Nicolas Schier
0 siblings, 1 reply; 4+ messages in thread
From: Arkadiusz Kozdra @ 2026-01-12 13:24 UTC (permalink / raw)
To: Nathan Chancellor
Cc: linux-kbuild, Masahiro Yamada, Nicolas Schier, Jakub Kicinski,
Alex Deucher, Geert Uytterhoeven, Mark Brown, Sam Ravnborg,
Arkadiusz Kozdra
W dniu 11.01.2026 o 00:20, Nathan Chancellor pisze:
>> -PKG="ncursesw menuw panelw"
>> -PKG2="ncurses menu panel"
> Is it worth a comment that the order of these packages is intentional to
> support static library builds? I do not mind adding after the fact to
> save you from sending a v2. I guess this situation is not too common
> since 1c5af5cf9308 is over six years old at this point but if any other
> dependencies become necessary in the future, it might help folks place
> them in the correct order.
Sure, this is because ld still only visits each archive once,
left-to-right, by design.
I think a comment about library dependencies and order would do a lot.
Feel free to reword and/or add comments as you please.
Thank you for your help.
- Arusekk
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] kconfig: fix static linking of nconf
2026-01-12 13:24 ` Arkadiusz Kozdra
@ 2026-01-14 13:26 ` Nicolas Schier
0 siblings, 0 replies; 4+ messages in thread
From: Nicolas Schier @ 2026-01-14 13:26 UTC (permalink / raw)
To: Arkadiusz Kozdra
Cc: Nathan Chancellor, linux-kbuild, Masahiro Yamada, Jakub Kicinski,
Alex Deucher, Geert Uytterhoeven, Mark Brown, Sam Ravnborg
On Mon, Jan 12, 2026 at 02:24:42PM +0100, Arkadiusz Kozdra wrote:
> W dniu 11.01.2026 o 00:20, Nathan Chancellor pisze:
> > > -PKG="ncursesw menuw panelw"
> > > -PKG2="ncurses menu panel"
> > Is it worth a comment that the order of these packages is intentional to
> > support static library builds? I do not mind adding after the fact to
> > save you from sending a v2. I guess this situation is not too common
> > since 1c5af5cf9308 is over six years old at this point but if any other
> > dependencies become necessary in the future, it might help folks place
> > them in the correct order.
>
> Sure, this is because ld still only visits each archive once, left-to-right,
> by design.
> I think a comment about library dependencies and order would do a lot.
> Feel free to reword and/or add comments as you please.
> Thank you for your help.
>
> - Arusekk
>
I will add this to kbuild-fixes-for-next with this comment added to
nconf-cfg.sh:
# Keep library order for static linking (HOSTCC='cc -static')
final inclusion in kbuild-fixes in about a week as long as there are no
regressions or vetos.
Kind regards,
Nicolas
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-01-14 13:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-10 11:48 [PATCH] kconfig: fix static linking of nconf Arkadiusz Kozdra
2026-01-10 23:20 ` Nathan Chancellor
2026-01-12 13:24 ` Arkadiusz Kozdra
2026-01-14 13:26 ` Nicolas Schier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox