uoaerg/wavemon

undefined reference to symbol 'keypad'

Closed this issue · 6 comments

$ make
CC about_scr.c
CC conf.c
CC conf_scr.c
CC error.c
CC help_scr.c
CC info_scr.c
CC iw_if.c
CC iw_nl80211.c
CC iw_scan.c
CC lhist_scr.c
CC llist.c
CC rfkill.c
CC scan_scr.c
CC ui.c
CC utils.c
cc -O2 -Wall -pthread -I/usr/include/libnl3 wavemon.c about_scr.o conf.o conf_scr.o error.o help_scr.o info_scr.o iw_if.o iw_nl80211.o iw_scan.o lhist_scr.o llist.o rfkill.o scan_scr.o ui.o utils.o -lcap -lncursesw -lm -lnl-genl-3 -lnl-3 -lnl-3 -o wavemon
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /tmp/ccJ254A0.o: undefined reference to symbol 'keypad'
/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /lib64/libtinfow.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [: wavemon] Error 1
2 :-(

On gentoo here, the following solves this compile problem:
./configure LIBS=-ltinfo

See post made by jmarshall at:
samtools/samtools#1149

$ cat /usr/lib64/libncurses.so
/* GNU ld script
Since Gentoo has critical dynamic libraries in /lib, and the static versions
in /usr/lib, we need to have a "fake" dynamic lib in /usr/lib, otherwise we
run into linking problems. This "fake" dynamic lib is a linker script that
redirects the linker to the real lib. And yes, this works in the cross-
compiling scenario as the sysroot-ed linker will prepend the real path.

See bug https://bugs.gentoo.org/4411 for more info.
*/
OUTPUT_FORMAT ( elf64-x86-64 )
GROUP ( /lib64/libncurses.so.6 )

I'm wondering if this has something to do with my segfault?

This does not look like a wavemon issue. Can you check if commenting out clear resolves the segfault?

Please try compiling some other ncurses program, such as mc or htop. It may be that you get similar errors, which would mean it is a gentoo build problem.

htop-3.0.2.tar.gz compiled without problems.

Searching for other ncurses tinfo related problems, found the following bug. Not sure if it'll help at all, talks about ncurses.

"Bug 457530 (tinfo) - [TRACKER] Failures with sys-libs/ncurses[tinfo]"
https://bugs.gentoo.org/457530

Comment #11:
Jeroen Roovers (RETIRED) gentoo-dev 2014-10-28 11:52:39 UTC

It's not as simple as switching pkg-config, as some packages simply need tinfo which was previously built into libncurses and now is not. Crudely linking against both isn't necessary for those cases.

@rogerxxxx - can you confirm whether replacing -lncursesw in the Makefile with the output of

ncursesw6-config --libs  # outputs -lncursesw -ltinfo -ldl

solves this problem and the SEGFAULT (#88)?

On Debian 10, I am able to use that to link against libncursesw6.1 / libtinfo6.1 without problems:

> lddtree ./wavemon
wavemon => ./wavemon (interpreter => /lib64/ld-linux-x86-64.so.2)
    libcap.so.2 => /lib/x86_64-linux-gnu/libcap.so.2
    libncursesw.so.6 => /lib/x86_64-linux-gnu/libncursesw.so.6
    libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2
        ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6
    libnl-genl-3.so.200 => /lib/x86_64-linux-gnu/libnl-genl-3.so.200
    libnl-3.so.200 => /lib/x86_64-linux-gnu/libnl-3.so.200
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6

@rogerxxxx - I spent some time to work out the above fix, which should pull in the right flags for curses5/6. As a result, it should no longer be necessary to supply this via CFLAGS / LIBS. Could you give this a spin please, and see if that also addresses #88?