You are not logged in.
When I build something, ld complains can't find curses library:
/usr/bin/ld: cannot find -lcurses
collect2: error: ld returned 1 exit statusBut my /usr/lib indeed contains curses related library:
# ls -lt /usr/lib/libcurse*
lrwxrwxrwx 1 root root 13 May 29 14:50 /usr/lib/libcurses.so -> libncurses.so
-rw-r--r-- 1 root root 18 May 29 14:50 /usr/lib/libcursesw.so
# ls -lt /usr/lib/libncurse*
-rw-r--r-- 1 root root 20 May 29 14:50 /usr/lib/libncurses++.so
lrwxrwxrwx 1 root root 18 May 29 14:50 /usr/lib/libncurses++w.so -> libncurses++w.so.6
lrwxrwxrwx 1 root root 20 May 29 14:50 /usr/lib/libncurses++w.so.6 -> libncurses++w.so.6.0
-rwxr-xr-x 1 root root 77264 May 29 14:50 /usr/lib/libncurses++w.so.6.0
-rw-r--r-- 1 root root 18 May 29 14:50 /usr/lib/libncurses.so
-rwxr-xr-x 1 root root 444776 May 29 14:50 /usr/lib/libncursesw.so.6.0
lrwxrwxrwx 1 root root 16 May 29 14:50 /usr/lib/libncursesw.so -> libncursesw.so.6
lrwxrwxrwx 1 root root 18 May 29 14:50 /usr/lib/libncursesw.so.6 -> libncursesw.so.6.0We can see libcurses.so points to libncurses.so, and libncurses.so is like this:
# cat /usr/lib/libncurses.so
INPUT(-lncursesw)I try to link -lncursesw directly, but there is still link error:
/usr/bin/ld: cannot find -lncursesw
collect2: error: ld returned 1 exit statusWhy can't ld find libcurses.so even though it is in /usr/lib directory?
Last edited by nanxiao (2017-07-28 09:51:12)
Offline
ldconfig -p | grep curses
Offline
@seth
# ldconfig -p | grep curses
libncursesw.so.6 (libc6,x86-64) => /usr/lib/libncursesw.so.6
libncursesw.so (libc6,x86-64) => /usr/lib/libncursesw.so
libncurses++w.so.6 (libc6,x86-64) => /usr/lib/libncurses++w.so.6
libncurses++w.so (libc6,x86-64) => /usr/lib/libncurses++w.soOffline
and what do you take from that?
Offline
@seth
> and what do you take from that?
I don't know why link -lncursesw also generate error. Could u give some clues? Thx!
Offline
https://stackoverflow.com/a/45370057/2106207 solve my doubt.
Offline
Yeah, sorry. First for the delay, second because I missed that you actually had tried the correct symbol as well.
(ftr: the actual compiler call/output would have been my question w/o the library name distraction, that's why there is https://bbs.archlinux.org/viewtopic.php?id=57855 ;-)
Offline