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'
Showing the changes to scripts (1 of 1 file). Show all
Unified · Split
| @@ -6,8 +6,9 @@ set -eu · 5 unmodified lines | |||
| 6 | cflags=$1 | 6 | cflags=$1 |
| 7 | libs=$2 | 7 | libs=$2 |
| 8 | 8 | ||
| 9 | PKG="ncursesw menuw panelw" | 9 | # Keep library order for static linking (HOSTCC='cc -static') |
| 10 | PKG2="ncurses menu panel" | 10 | PKG="menuw panelw ncursesw" |
| 11 | PKG2="menu panel ncurses" | ||
| 11 | 12 | ||
| 12 | if [ -n "$(command -v ${HOSTPKG_CONFIG})" ]; then | 13 | if [ -n "$(command -v ${HOSTPKG_CONFIG})" ]; then |
| 13 | if ${HOSTPKG_CONFIG} --exists $PKG; then | 14 | if ${HOSTPKG_CONFIG} --exists $PKG; then |
| @@ -28,19 +29,19 @@ fi · 14 unmodified lines | |||
| 28 | # find ncurses by pkg-config.) | 29 | # find ncurses by pkg-config.) |
| 29 | if [ -f /usr/include/ncursesw/ncurses.h ]; then | 30 | if [ -f /usr/include/ncursesw/ncurses.h ]; then |
| 30 | echo -D_GNU_SOURCE -I/usr/include/ncursesw > ${cflags} | 31 | echo -D_GNU_SOURCE -I/usr/include/ncursesw > ${cflags} |
| 31 | echo -lncursesw -lmenuw -lpanelw > ${libs} | 32 | echo -lmenuw -lpanelw -lncursesw > ${libs} |
| 32 | exit 0 | 33 | exit 0 |
| 33 | fi | 34 | fi |
| 34 | 35 | ||
| 35 | if [ -f /usr/include/ncurses/ncurses.h ]; then | 36 | if [ -f /usr/include/ncurses/ncurses.h ]; then |
| 36 | echo -D_GNU_SOURCE -I/usr/include/ncurses > ${cflags} | 37 | echo -D_GNU_SOURCE -I/usr/include/ncurses > ${cflags} |
| 37 | echo -lncurses -lmenu -lpanel > ${libs} | 38 | echo -lmenu -lpanel -lncurses > ${libs} |
| 38 | exit 0 | 39 | exit 0 |
| 39 | fi | 40 | fi |
| 40 | 41 | ||
| 41 | if [ -f /usr/include/ncurses.h ]; then | 42 | if [ -f /usr/include/ncurses.h ]; then |
| 42 | echo -D_GNU_SOURCE > ${cflags} | 43 | echo -D_GNU_SOURCE > ${cflags} |
| 43 | echo -lncurses -lmenu -lpanel > ${libs} | 44 | echo -lmenu -lpanel -lncurses > ${libs} |
| 44 | exit 0 | 45 | exit 0 |
| 45 | fi | 46 | fi |
| 46 | 47 | ||