4

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.

Aleksandar Makragić
  • 1,957
  • 17
  • 32
  • How do you call gcc? are you explicitly giving gcc the path for inclusion of lcurses? – R4PH43L Nov 29 '15 at 15:13
  • 2
    http://stackoverflow.com/questions/33982606/makefile-samtools-installation-failed You can see my makefile here. Basically I'm trying to install samtools but it fails because of this library. – Aleksandar Makragić Nov 29 '15 at 15:20
  • As you yourself posted a question for the same error, this should be marked as a duplicate of http://stackoverflow.com/questions/33982606/makefile-samtools-installation-failed . Could be better served at [SuperUser](https://superuser.com) or [Unix & Linux](https://unix.stackexchange.com/) – R4PH43L Nov 29 '15 at 15:24
  • gcc doesn't know about this `/usr/lib/curses` place. You need to tell it. Read the documentation about the `-L` option. – n. m. could be an AI Nov 29 '15 at 15:28
  • 1
    I read everything, I tried everything, please don't tell me read documentation I'm reading for last 5 hours. – Aleksandar Makragić Nov 29 '15 at 15:30
  • Agreeing that `/usr/lib/curses` is odd - perhaps OP copied files from someplace. By the way, posting to multiple forums confuses people. – Thomas Dickey Nov 29 '15 at 15:46
  • 1
    I'm sorry for that, originally I taught the problem was with samtools which I'm trying to install. – Aleksandar Makragić Nov 29 '15 at 15:51
  • @АлександарМакрагић What is the exact linker error message now that that you installed libncurses-devel? – Mike Kinghan Nov 29 '15 at 15:53

2 Answers2

3

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.

Mike Kinghan
  • 55,740
  • 12
  • 153
  • 182
2

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.

Community
  • 1
  • 1
Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105