History

kconfig: fix static linking of nconf

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'

Arkadiusz Kozdra committed 10 months ago

Commit baaecfc1 parent 946d4621 file · +6 −5Browse files

Showing the changes to scripts (1 of 1 file). Show all

Unified · Split

scripts/kconfig/nconf-cfg.sh+6−5
@@ -6,8 +6,9 @@ set -eu · 5 unmodified lines
66 cflags=$1
77 libs=$2
88
9−PKG="ncursesw menuw panelw"
10−PKG2="ncurses menu panel"
9+# Keep library order for static linking (HOSTCC='cc -static')
10+PKG="menuw panelw ncursesw"
11+PKG2="menu panel ncurses"
1112
1213 if [ -n "$(command -v ${HOSTPKG_CONFIG})" ]; then
1314 if ${HOSTPKG_CONFIG} --exists $PKG; then
@@ -28,19 +29,19 @@ fi · 14 unmodified lines
2829 # find ncurses by pkg-config.)
2930 if [ -f /usr/include/ncursesw/ncurses.h ]; then
3031 echo -D_GNU_SOURCE -I/usr/include/ncursesw > ${cflags}
31− echo -lncursesw -lmenuw -lpanelw > ${libs}
32+ echo -lmenuw -lpanelw -lncursesw > ${libs}
3233 exit 0
3334 fi
3435
3536 if [ -f /usr/include/ncurses/ncurses.h ]; then
3637 echo -D_GNU_SOURCE -I/usr/include/ncurses > ${cflags}
37− echo -lncurses -lmenu -lpanel > ${libs}
38+ echo -lmenu -lpanel -lncurses > ${libs}
3839 exit 0
3940 fi
4041
4142 if [ -f /usr/include/ncurses.h ]; then
4243 echo -D_GNU_SOURCE > ${cflags}
43− echo -lncurses -lmenu -lpanel > ${libs}
44+ echo -lmenu -lpanel -lncurses > ${libs}
4445 exit 0
4546 fi
4647