Building Vim from Source in Cygwin

2019-02-11 04:14发布

问题:

I am trying to build Vim from the source packages, under Cygwin, to enable Python support. I am following the instructions given here, but I'm hitting this error when I run the configure script:

checking --with-tlib argument... empty: automatic terminal library selection
checking for tgetent in -lncurses... no
checking for tgetent in -ltermlib... no
checking for tgetent in -ltermcap... no
checking for tgetent in -lcurses... no
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.

The Vim source package gets downloaded as /usr/src/vim-7.3.tar.gz, which I extract and then attempt to build using:

./configure --prefix=/usr/local --enable-multibyte --without-x --enable-gui=no --enable-pythoninterp

The prefix option was suggested in this SO post, where the OP is having the exact same problem. However, I installed the ncurses Cygwin package (and also ncursesw), as well as their library equivalents, so I'm not sure what's going wrong for me (i.e., why the configure script can't find them). I've tried explicitly setting the --with-tlib argument (e.g., --with-tlib=/bin/cygncurses-10.dll, ncurses, libncurses10 and libncurses), but it fails in the same place with something like:

checking for linking with libncurses10 library... configure: error: FAILED

The ncurses packages I have installed are:

  • libncursesw10 (5.7-18)
  • libncurses10 (5.7-18)
  • libncurses9 (5.7-16)
  • libncurses8 (5.5-10)
  • ncurses (5.7-18)
  • ncursesw (5.7-18)

All suggestions welcome!!

回答1:

I think you're missing a required package. Lengthy explanation follows; jump to the end for the answer.

I ran the exact same ./configure ... command on my own system (Windows 7, Cygwin). Part of its output was:

checking for tgetent in -lncurses... yes

which indicates that I don't have the same problem you have.

The configure script writes a more verbose log to src/auto/config.log. On my system, that shows:

configure:9777: checking for tgetent in -lncurses
configure:9802: gcc -o conftest.exe -g -O2   -L/usr/local/lib conftest.c -lncurses  -lelf   >&5
configure:9802: $? = 0
configure:9812: result: yes

The -lncurses option tells the linker to look at /usr/lib/libncurses.foo, where .foo can be .a, or .so, or .dll, depending on the system and whether you're doing dynamic linking. On Cygwin, the cygcheck command can tell you which package owns a specified file or files. On my system:

$ ls /usr/lib/libncurses.*
/usr/lib/libncurses.a  /usr/lib/libncurses.dll.a  /usr/lib/libncurses.la
$ cygcheck -f /usr/lib/libncurses.*
libncurses-devel-5.7-18
libncurses-devel-5.7-18
libncurses-devel-5.7-18

I believe that installing libncurses-devel (via the Cygwin setup.exe) should fix your problem.