Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GCC ld: can't find -lcurses

Tags:

gcc

ld

curses

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.

like image 957
Aleksandar Makragić Avatar asked Sep 05 '25 17:09

Aleksandar Makragić


2 Answers

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.

like image 173
Mike Kinghan Avatar answered Sep 11 '25 03:09

Mike Kinghan


You need a development library for ncurses installed, i.e., ncurses-devel (for SuSE).

Without the development library, the shared libraries for ncurses are only present as runtime files.

The ncurses development package installs files or symbolic links to make these options work: -lcurses, -lncurses (since the former is standard). It also installs the file to make -lncursesw link, but OP is not using that.

That message

skipping incompatible /usr/lib/libcurses.so

makes it seem as if OP copied files from some other system rather than installing OpenSuSE packages.

The extra question in SuperUser (GCC ld: can't find -lcurses) gives more information, but not enough to see why the file /usr/lib/libcurses.so is incompatible. It may be conflicting with the development package, however.

like image 38
Thomas Dickey Avatar answered Sep 11 '25 02:09

Thomas Dickey