-1

This is not a duplicate of ncurses not found when trying to build vim. ncurses not found when trying to build vim shows how to solve a problem, while I'm asking why it is a problem.

I want to build vim from source. Used a following command line to do it:

./configure --with-features=huge \
    --enable-multibyte \
    --enable-rubyinterp=yes \
    --enable-pythoninterp=yes \
    --with-python-config-dir=/usr/lib64/python2.7/config \
    --enable-python3interp=yes \
    --with-python3-config-dir=/usr/lib64/python3.6/config-3.6m-x86_64-linux-gnu \
    --enable-perlinterp=yes \
    --enable-luainterp=yes \
    --enable-cscope \
    --prefix=/usr/local

Got the follow error:

checking --with-tlib argument... empty: automatic terminal library selection
checking for tgetent in -ltinfo... yes
tinfo library is not usable
checking for tgetent in -lncurses... yes
ncurses library is not usable
checking for tgetent in -ltermlib... no
checking for tgetent in -ltermcap... yes
termcap library is not usable
checking for tgetent in -lcurses... yes
curses library is not usable
no terminal library found
checking for tgetent()... configure: error: NOT FOUND!
      You need to install a terminal library; for example ncurses.
      Or specify the name of the library with --with-tlib.

I do have curses library installed Here is what find /usr -type f -name "libncurses*" revealed

/usr/lib/libncursesw.so.6.1
/usr/lib/libncurses.so.6.1
/usr/lib64/libncurses++w.so.5.9
/usr/lib64/libncurses++w.so.6.1
/usr/lib64/libncursesw.so.5.9
/usr/lib64/libncurses++.so.5.9
/usr/lib64/libncursesw.so.6.1
/usr/lib64/libncurses.so
/usr/lib64/vlc/plugins/gui/libncurses_plugin.so
/usr/lib64/libncurses.so.6.1
/usr/lib64/libncurses.so.5.9
/usr/lib64/libncursesw.so
/usr/lib64/libncurses++.so.6.1

After several hours of googling I tried the following approach

CFLAGS+=-fPIC ./configure --with-features=huge \
    --enable-multibyte \
    --enable-rubyinterp=yes \
    --enable-pythoninterp=yes \
    --with-python-config-dir=/usr/lib64/python2.7/config \
    --enable-python3interp=yes \
    --with-python3-config-dir=/usr/lib64/python3.6/config-3.6m-x86_64-linux-gnu \
    --enable-perlinterp=yes \
    --enable-luainterp=yes \
    --enable-cscope \
    --prefix=/usr/local

i.e. I simply added a CFLAGS+=-fPIC. I know what the flag does. However I fail to see a connection between this flag and my ncurses library being unusable.

So my questions are:

  1. What makes my ncurses library unusable?
  2. Why using -fPIC works?

My system:

$ uname -a
Linux user-fedora-PC0PVGAT 4.18.16-200.fc28.x86_64 #1 SMP Sat Oct 20 23:53:47 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/os-release
NAME=Fedora
VERSION="28 (Workstation Edition)"
ID=fedora
VERSION_ID=28
PLATFORM_ID="platform:f28"
PRETTY_NAME="Fedora 28 (Workstation Edition)"
ANSI_COLOR="0;34"
CPE_NAME="cpe:/o:fedoraproject:fedora:28"
HOME_URL="https://fedoraproject.org/"
SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=28
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=28
PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"
VARIANT="Workstation Edition"
VARIANT_ID=workstation
flashburn
  • 4,180
  • 7
  • 54
  • 109
  • Possible duplicate of [ncurses not found when trying to build vim](https://stackoverflow.com/questions/34693071/ncurses-not-found-when-trying-to-build-vim) – perreal Nov 06 '18 at 04:22
  • The **`config.log`** file will show the problem. Without that (and some attempt at analysis), this is off-topic. – Thomas Dickey Nov 06 '18 at 09:17

1 Answers1

1

I encountered the same question, and, solve it by replace compiler to clang like that:

CC=clang CXX=clang++ LD=clang LDFLAGS=-fno-lto ./configure ....

How to deal with? I tried with the following steps:

  1. Check src/auto/config.log
  2. Found an abnormal hint usr/bin/ld: output.o: relocation R_X86_64_32 against '.rodata.str1.1' can not be used when maki
  3. then remember the first time I installed vim about 1 year ago, with above clang options...

Finnally, if the method above does not work, try to use the shared object form of libpython. hope to help you~

PilotPaul
  • 11
  • 2