Cygwin/VIM 配置:缺少终端库(例如 ncurses)

问题描述 投票:0回答:1

我现在已经在这个问题上工作了 6 个小时,但我仍然想不出比我现在拥有的命令更多的东西(在网上查看解决方案和对其他遇到这个问题的穷人的回答之后)。

我尝试在安装了 python3 和 mingw32 的 Windows+Cygwin 上构建 vim 编辑器(默认命令为 g++、c++、……所有参考特定命令,如“i686-w64-mingw32-c++”)

和其他许多人一样,我遇到了错误,终端库丢失(例如 ncurses)。

在尝试配置 vim 项目很多小时后,我仍然卡住了。 我已经尝试过:

  • 将工具链更改为 cygwin 包(切换回自定义 mingw32 安装)
  • 安装不同版本的 ncurses(将库复制到不同位置,如 /usr/lib/usr/local/lib/lib
  • 多次编写不同的./configure命令

我当前的配置语句:

LD_LIBRARY_PATH=/cygdrive/d/developtools/mingw32/lib ./configure 
    --with-features=huge \
    --enable-multibyte \
    --enable-python3interp=yes \
    --with-python3-config-dir=/usr/lib/python3.6/config-3.6m-x86_64-cygwin \
    --enable-cscope \
    --with-tlib=ncurses

我当前的 config.log 文件的一部分

configure:11342: result: no
configure:11348: checking --with-tlib argument
configure:11357: result: ncurses
configure:11360: checking for linking with ncurses library
configure:11373: gcc -o conftest.exe -g -O2   -L/usr/local/lib conftest.c  -lncurses >&5
configure:11373: $? = 0
configure:11374: result: OK
configure:11477: checking for tgetent()
configure:11490: gcc -o conftest.exe -g -O2   -L/usr/local/lib conftest.c  -lncurses >&5
conftest.c: In function 'main':
conftest.c:49:26: warning: implicit declaration of function 'tgetent' [-Wimplicit-function-declaration]
 char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist");
                          ^~~~~~~

我也一直在想,如果刚刚产生同样的错误信息(需要终端库),因为

tgetent
的声明(或定义)似乎有问题。

最后还是一样的错误信息

configure:11494: error: NOT FOUND!
      You need to install a terminal library; for example ncurses.
      Or specify the name of the library with --with-tlib.

有人在使用自定义安装的工具链时在 cygwin 的 Windows 上工作时遇到过同样的问题吗?

提前谢谢你。如果您需要更多信息,请随时询问。


编辑(11.07.2017, 11:35-CH)

这是我的第一个错误,在配置过程中重复了几次:

configure:3503: gcc -E  conftest.c
conftest.c:10:28: fatal error: ac_nonexistent.h: No such file or directory
 #include <ac_nonexistent.h>
                            ^
compilation terminated.
configure:3503: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define UNIX 1
| /* end confdefs.h.  */
| #include <ac_nonexistent.h>
configure:3528: result: gcc -E

编辑(11.07.2017, 13:42-CH)

有了babun,我终于可以运行

configure
vim了。但是在运行时
make
我得到了另一个错误:

Starting make in the src directory.
If there are problems, cd to the src directory and run make there
cd src && D:/developtools/mingw32/bin/mingw32-make first
mingw32-make[1]: Entering directory 'D:/developtools/.babun/cygwin/home/tobbe/vim/src'
gcc -c -I.   -I/usr/include/python2.7 -DPYTHON_HOME='"/usr"' -pthread -fPIE    -Iproto -DHAVE_CONFIG_H     -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1        -o objects/option.o option.c
gcc: fatal error: no input files
compilation terminated.
Makefile:3215: recipe for target 'objects/option.o' failed
mingw32-make[1]: *** [objects/option.o] Error 1

我已经查看了对象目录,实际上 option.o 没有创建。

c++ vim terminal cygwin
1个回答
0
投票

我最近遇到同样的问题。 在 cygwin vim 上

./configure
失败并显示以下消息。

checking for tgetent()... configure: error: NOT FOUND!
      You need to install a terminal library; for example ncurses.
      On Linux that would be the libncurses-dev package.
      Or specify the name of the library with --with-tlib.

但是

libncurses-dev
已经安装了。

四处搜索后,按照

here
的建议检查src/auto/config.log

configure:11931: checking for tgetent in -lcurses
configure:11956: gcc -o conftest.exe -g -O2   -L/usr/local/lib conftest.c -lcurses   -lselinux >&5
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lselinux: No such file or directory
collect2: error: ld returned 1 exit status

然后转到

/usr/lib
&&
/usr/local/lib

ls -l /usr/lib /usr/local/lib
/usr/lib:
total 109995
... libncurses.a libncurses.dll.a ...
/usr/local/lib:
total 0
python3.8

现在找到原因了,

libncurses
/usr/lib
,但不知何故
./configure
使用了
/usr/local/lib
,让我们添加链接标志。 在这种情况下,在
./configure
加上
LDFLAGS="-L/usr/lib" 
之后,构建成功。以下是
src/auto/config.log

中的新输出
configure:11931: checking for tgetent in -lncursesw
configure:11956: gcc -o conftest.exe -g -O2  -L/usr/lib -L/usr/local/lib conftest.c -lncursesw    >&5
configure:11956: $? = 0
configure:11966: result: yes

此外,在 cygwin 上,要构建 vim,请确保至少安装以下软件包。

make automake libncurses-devel gcc-g++ cscope python3-devel

更多信息:

automake automatically add autoconf
gcc-g++ automatically add gcc-core
libncurses-devel automatically add pkg-config libncursesw10 libncurses++w10
© www.soinside.com 2019 - 2024. All rights reserved.