Question

I'm trying to install terminfo cabal package on my Windows Cygwin installation, but it fails because of curses headers:

$ 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

At the same time, NCurses is installed correctly (/usr/include/ncursesw and ncurses). If before compilation I explicitly add that sub-folder to GCC, it proceeds

export C_INCLUDE_PATH=/usr/include/ncursesw

re-running cabal produced another error:

...
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
Was it helpful?

Solution

So I tried cabal install terminfo --extra-lib-dirs=/lib/ncursesw, but then I realized that cabal is a windows app, so I've also tried --extra-lib-dirs=c:/cygwin/lib/ncursesw

In the end, final solution is as follows:

  1. Install Cygwin and ncursesw-devel package there
  2. Run cygwin and configure GCC: $ export C_INCLUDE_PATH=/usr/include/ncursesw
  3. Since C:\cygwin\usr\include\ncursesw\ncurses.h is a soft-reference in Cygwin, you should manually replace this file with curses.h from the same folder
  4. From the same Cygwin terminal you can now start Cabal (it's a Windows program!):

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

So, the library was installed. But when I try to actually use that function, ghc complains:

Loading package terminfo-0.3.2.5 ... linking ... ghc.exe: c:/cygwin/lib\libncursesw.a: unknown symbol `__imp____ctype_ptr__'
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top