2

我正在尝试terminfo在我的 Windows Cygwin 安装上安装 cabal 包,但由于curses标题而失败:

$ cabal install terminfo
Resolving dependencies...
Configuring terminfo-0.3.2.5...
configure: WARNING: unrecognized options: --with-compiler, --with-gcc
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
...
checking ncurses.h usability... no
checking ncurses.h presence... no
checking for ncurses.h... no
checking curses.h usability... no
checking curses.h presence... no
checking for curses.h... no
configure: error: in `/tmp/terminfo-0.3.2.5-620/terminfo-0.3.2.5':
configure: error: curses headers could not be found, so this package cannot be built
See `config.log' for more details
Failed to install terminfo-0.3.2.5
cabal.exe: Error: some packages failed to install:
terminfo-0.3.2.5 failed during the configure step. The exception was:
ExitFailure 1

同时,正确安装了 NCurses (/usr/include/ncurseswncurses)。如果在编译之前我明确将该子文件夹添加到 GCC,它将继续

export C_INCLUDE_PATH=/usr/include/ncursesw

重新运行 cabal 产生了另一个错误:

...
checking ncurses.h usability... yes
checking ncurses.h presence... yes
checking for ncurses.h... yes
checking for setupterm in -lncursesw... yes
configure: creating ./config.status
config.status: creating terminfo.buildinfo
configure: WARNING: unrecognized options: --with-compiler, --with-gcc
cabal.exe: Missing dependency on a foreign library:
* Missing (or bad) header file: ncurses.h
* Missing C library: ncursesw
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.
If the header file does exist, it may contain errors that are caught by the C
compiler at the preprocessing stage. In this case you can re-run configure
with the verbosity flag -v3 to see the error messages.
Failed to install terminfo-0.3.2.5
cabal.exe: Error: some packages failed to install:
terminfo-0.3.2.5 failed during the configure step. The exception was:
ExitFailure 1
4

1 回答 1

2

所以我尝试cabal install terminfo --extra-lib-dirs=/lib/ncursesw了,但后来我意识到 cabal 是一个 Windows 应用程序,所以我也尝试过--extra-lib-dirs=c:/cygwin/lib/ncursesw

最后,最终解决方案如下:

  1. 在那里安装 Cygwin 并ncursesw-devel打包
  2. 运行 cygwin 并配置 GCC: $ export C_INCLUDE_PATH=/usr/include/ncursesw
  3. 由于C:\cygwin\usr\include\ncursesw\ncurses.h是 Cygwin 中的软引用,因此您应该手动将此文件替换curses.h为同一文件夹中的文件
  4. 现在,您可以从同一个 Cygwin 终端启动 Cabal(它是一个 Windows 程序!):

    $ cabal install terminfo --extra-lib-dirs=c:/cygwin/lib --extra-include-dirs=c:/cygwin/usr/include/ncursesw --extra-include-dirs=c:/cygwin/usr/include

因此,安装了库。但是当我尝试实际使用该功能时,ghc 抱怨:

Loading package terminfo-0.3.2.5 ... linking ... ghc.exe: c:/cygwin/lib\libncursesw.a: unknown symbol `__imp____ctype_ptr__'
于 2013-09-03T12:44:01.977 回答