Search code examples
gccldcurses

GCC ld: can't find -lcurses


I'm trying to use make install, and I get error:

cannot find -lcurses

In my /usr/lib/curses/ I have two files: libcurses.so and libcurses.a.

So I do have that library, gcc just doesn't see it. I've read almost everything I can find but still couldn't make this work.

Any help would be appreciated.

This is output:

/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: skipping incompatible /usr/lib/libcurses.so when searching for -lcurses
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: cannot find -lcurses
collect2: error: ld returned 1 exit status
Makefile:125: recipe for target 'samtools' failed
make: *** [samtools] Error 1

Note: I've read every similar topic on this website, so please, don't mark this as duplicate.


Solution

  • The linker says:

    /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: \
    skipping incompatible /usr/lib/libcurses.so when searching for -lcurses
    /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: cannot find -lcurses
    

    You are performing a 64-bit build, but the the only libcurses.so the linker can find is 32-bit, so it is skipped.

    It is unclear from your several postings how this 32-bit /usr/lib/libcurses.so got there. The official latest openSUSE curses runtime package is libncurses5-5.9-53.4.x86_64.rpm. The official latest developent package is ncurses-devel-5.9-53.4.x86_64.rpm. If you install either of these packages, they do not place any 32-bit binaries under /usr/lib, so I surmise that your /usr/lib/libcurses.so got there in some unorthodox way.

    Delete this /usr/lib/libcurses.so. Install the ncurses-devel rpm from your distribution's package manager, e.g.zypper install ncurses-devel. To make sure you have done it successfully, check that /usr/lib64/libncurses.so exists afterwards. Then in your makefile change:

    LIBCURSES=  -lcurses
    

    to:

    LIBCURSES=  -lncurses
    

    You will find that this change is described in paragraph 3 of the samtools INSTALL file.