代码之家  ›  专栏  ›  技术社区  ›  Alexander Kosenkov

在Windows中安装Haskell terminfo

  •  2
  • Alexander Kosenkov  · 技术社区  · 12 年前

    我正在尝试安装 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/ncursesw ncurses ). 如果在编译之前,我明确地将该子文件夹添加到GCC中,它将继续

    export C_INCLUDE_PATH=/usr/include/ncursesw
    

    重新运行阴谋集团产生了另一个错误:

    ...
    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
    
    1 回复  |  直到 12 年前
        1
  •  2
  •   Alexander Kosenkov    12 年前

    所以我试过了 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__'