Skip to content

Haskell/Stack: terminfo library cannot be built because of missing ncurses #15995

@fmthoma

Description

@fmthoma

Issue description

When building a haskell project depending on the terminfo library (possibly through other libraries like vty) using stack --nix, the build fails since the ncurses library cannot be found during the configure phase of terminfo. Adding

nix:
  packages: [ncurses]

to stack.yaml remedies the problem, however this is a very ad-hoc solution. The problem also already occurred for ghc (#2969, #5616) and others (ekmett/wl-pprint-terminfo#7).

Steps to reproduce

  • Start with a clean stack environment (mv ~/.stack ~/.stack.bkup)

  • Set up a new stack/cabal project (stack new foo)

  • Make the project depend on terminfo by adding in your foo.cabal:

    [...]
    executable foo-exe
      hs-source-dirs:      app
      main-is:             Main.hs
      ghc-options:         -threaded -rtsopts -with-rtsopts=-N
      build-depends:       base
                         , terminfo -- <- add this line
                         , foo
      default-language:    Haskell2010
    [...]
    
  • stack --nix build

Result:

terminfo-0.4.0.2: download
terminfo-0.4.0.2: configure
Progress: 1/2
--  While building package terminfo-0.4.0.2 using:
      /run/user/1000/stack13135/terminfo-0.4.0.2/.stack-work/dist/x86_64-linux-nix/Cabal-1.22.5.0/setup/setup --builddir=.stack-work/dist/x86_64-linux-nix/Cabal-1.22.5.0 configure --with-ghc=/nix/store/n962p1idgzh07wvhxam5r6icv894kj61-ghc-7.10.3/bin/ghc --with-ghc-pkg=/nix/store/n962p1idgzh07wvhxam5r6icv894kj61-ghc-7.10.3/bin/ghc-pkg --user --package-db=clear --package-db=global --package-db=/home/fthoma/.stack/snapshots/x86_64-linux-nix/lts-5.0/7.10.3/pkgdb --libdir=/home/fthoma/.stack/snapshots/x86_64-linux-nix/lts-5.0/7.10.3/lib --bindir=/home/fthoma/.stack/snapshots/x86_64-linux-nix/lts-5.0/7.10.3/bin --datadir=/home/fthoma/.stack/snapshots/x86_64-linux-nix/lts-5.0/7.10.3/share --libexecdir=/home/fthoma/.stack/snapshots/x86_64-linux-nix/lts-5.0/7.10.3/libexec --sysconfdir=/home/fthoma/.stack/snapshots/x86_64-linux-nix/lts-5.0/7.10.3/etc --docdir=/home/fthoma/.stack/snapshots/x86_64-linux-nix/lts-5.0/7.10.3/doc/terminfo-0.4.0.2 --htmldir=/home/fthoma/.stack/snapshots/x86_64-linux-nix/lts-5.0/7.10.3/doc/terminfo-0.4.0.2 --haddockdir=/home/fthoma/.stack/snapshots/x86_64-linux-nix/lts-5.0/7.10.3/doc/terminfo-0.4.0.2 --dependency=base=base-4.8.2.0-0d6d1084fbc041e1cded9228e80e264d --extra-include-dirs=/nix/store/n962p1idgzh07wvhxam5r6icv894kj61-ghc-7.10.3/include --extra-lib-dirs=/nix/store/n962p1idgzh07wvhxam5r6icv894kj61-ghc-7.10.3/lib
    Process exited with code: ExitFailure 1
    Logs have been written to: /home/fthoma/projects/foo/.stack-work/logs/terminfo-0.4.0.2.log

    [1 of 1] Compiling Main             ( /run/user/1000/stack13135/terminfo-0.4.0.2/Setup.lhs, /run/user/1000/stack13135/terminfo-0.4.0.2/.stack-work/dist/x86_64-linux-nix/Cabal-1.22.5.0/setup/Main.o )
    Linking /run/user/1000/stack13135/terminfo-0.4.0.2/.stack-work/dist/x86_64-linux-nix/Cabal-1.22.5.0/setup/setup ...
    Configuring terminfo-0.4.0.2...
    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.out
    checking for suffix of executables... 
    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 whether gcc accepts -g... yes
    checking for gcc option to accept ISO C89... none needed
    checking how to run the C preprocessor... gcc -E
    checking for grep that handles long lines and -e... /nix/store/dp6c8mcsashywfkppdzic3l1qz4n9paq-gnugrep-2.22/bin/grep
    checking for egrep... /nix/store/dp6c8mcsashywfkppdzic3l1qz4n9paq-gnugrep-2.22/bin/grep -E
    checking for ANSI C header files... yes
    checking for sys/types.h... yes
    checking for sys/stat.h... yes
    checking for stdlib.h... yes
    checking for string.h... yes
    checking for memory.h... yes
    checking for strings.h... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for unistd.h... 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 `/run/user/1000/stack13135/terminfo-0.4.0.2':
    configure: error: curses headers could not be found, so this package cannot be built
    See `config.log' for more details

Technical details

  • System: NixOS 16.03.886.0068260 (Emu)
  • Nix version: nix-env (Nix) 1.11.2
  • Nixpkgs version: 16.03.886.0068260
  • Stackage: tried with LTS-5.0 through LTS-5.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: questionRequests for a specific question to be answered6.topic: haskellGeneral-purpose, statically typed, purely functional programming language

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions