Установите термининформацию Haskell в Windows

Я пытаюсь установить пакет terminfo cabal в своей установке Windows Cygwin, но это не удается из-за заголовков 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

повторный запуск 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

person Alexander Kosenkov    schedule 03.09.2013    source источник


Ответы (1)


Итак, я попробовал 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__'
person Alexander Kosenkov    schedule 03.09.2013