Stack: configure: error: curses library not found, so this package cannot be built when installing terminfo on nixos

Created on 27 Jun 2017  Â·  5Comments  Â·  Source: commercialhaskell/stack

Using stack 1.4.0 compiled with Cabal-1.24.2.0 on Nixos 17.03 with lts-8.20 and ghc-8.0.2, I can't install terminfo on any of my projects:

mzabani@nixos:~/Projects/bancot]$ stack install terminfo
terminfo-0.4.1.0: configure
Package terminfo uses a custom Cabal build, but does not use a custom-setup stanza
Not using the explicit setup deps approach based on configuration
Strongly recommend fixing the package's cabal file

--  While building package terminfo-0.4.1.0 using:
  /run/user/1000/stack10060/terminfo-0.4.1.0/.stack-work/dist/x86_64-linux-nix/Cabal-1.24.2.0/setup/setup --builddir=.stack-work/dist/x86_64-linux-nix/Cabal-1.24.2.0 configure --with-ghc=/nix/store/8v64zpyci6rgrzzbhc2bfa911yfmnfw5-ghc-8.0.2/bin/ghc --with-ghc-pkg=/nix/store/8v64zpyci6rgrzzbhc2bfa911yfmnfw5-ghc-8.0.2/bin/ghc-pkg --user --package-db=clear --package-db=global --package-db=/home/mzabani/.stack/snapshots/x86_64-linux-nix/lts-8.20/8.0.2/pkgdb --libdir=/home/mzabani/.stack/snapshots/x86_64-linux-nix/lts-8.20/8.0.2/lib --bindir=/home/mzabani/.stack/snapshots/x86_64-linux-nix/lts-8.20/8.0.2/bin --datadir=/home/mzabani/.stack/snapshots/x86_64-linux-nix/lts-8.20/8.0.2/share --libexecdir=/home/mzabani/.stack/snapshots/x86_64-linux-nix/lts-8.20/8.0.2/libexec --sysconfdir=/home/mzabani/.stack/snapshots/x86_64-linux-nix/lts-8.20/8.0.2/etc --docdir=/home/mzabani/.stack/snapshots/x86_64-linux-nix/lts-8.20/8.0.2/doc/terminfo-0.4.1.0 --htmldir=/home/mzabani/.stack/snapshots/x86_64-linux-nix/lts-8.20/8.0.2/doc/terminfo-0.4.1.0 --haddockdir=/home/mzabani/.stack/snapshots/x86_64-linux-nix/lts-8.20/8.0.2/doc/terminfo-0.4.1.0 --dependency=base=base-4.9.1.0 --extra-include-dirs=/nix/store/05053nfzcqbrij1qxd2z20yhamyg14dj-glpk-4.61/include --extra-include-dirs=/nix/store/6m705shsri2f131cq07fq95dswcrjg5l-postgresql-9.5.6/include --extra-include-dirs=/nix/store/8s9rnmlr3kpf1g9wwr5hzxiiqk706mlw-zlib-1.2.11-dev/include --extra-include-dirs=/nix/store/8v64zpyci6rgrzzbhc2bfa911yfmnfw5-ghc-8.0.2/include --extra-include-dirs=/nix/store/hasadnj5n3lfmm3n85knhwq7kb61i63g-pcre-8.40-dev/include --extra-include-dirs=/nix/store/pf89226bwyplwszk8brivdfrx04ly7k5-ncurses-6.0-dev/include --extra-lib-dirs=/nix/store/05053nfzcqbrij1qxd2z20yhamyg14dj-glpk-4.61/lib --extra-lib-dirs=/nix/store/8v64zpyci6rgrzzbhc2bfa911yfmnfw5-ghc-8.0.2/lib --extra-lib-dirs=/nix/store/ally147d2h11jv34w1saml1ni7kkxmch-pcre-8.40/lib --extra-lib-dirs=/nix/store/kk8r62xz5g1hn1mn1307fcj24anp5m6g-zlib-1.2.11/lib --extra-lib-dirs=/nix/store/sj8rnawbay2j2hiqgazsbq05rlpha5lq-ncurses-6.0/lib --extra-lib-dirs=/nix/store/smqi632v999n8i77q5f74cwhc9a1vyhy-postgresql-9.5.6-lib/lib
Process exited with code: ExitFailure 1
Logs have been written to: /home/mzabani/Projects/bancot/.stack-work/logs/terminfo-0.4.1.0.log

[1 of 2] Compiling Main             ( /run/user/1000/stack10060/terminfo-0.4.1.0/Setup.lhs, /run/user/1000/stack10060/terminfo-0.4.1.0/.stack-work/dist/x86_64-linux-nix/Cabal-1.24.2.0/setup/Main.o )
[2 of 2] Compiling StackSetupShim   ( /home/mzabani/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs, /run/user/1000/stack10060/terminfo-0.4.1.0/.stack-work/dist/x86_64-linux-nix/Cabal-1.24.2.0/setup/StackSetupShim.o )
Linking /run/user/1000/stack10060/terminfo-0.4.1.0/.stack-work/dist/x86_64-linux-nix/Cabal-1.24.2.0/setup/setup ...
Configuring terminfo-0.4.1.0...
configure: WARNING: unrecognized options: --with-compiler
checking for gcc... /nix/store/b43ww9wkpwjxha7ql7mizxpa2vb6yk5r-gcc-wrapper-5.4.0/bin/cc
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 /nix/store/b43ww9wkpwjxha7ql7mizxpa2vb6yk5r-gcc-wrapper-5.4.0/bin/cc accepts -g... yes
checking for /nix/store/b43ww9wkpwjxha7ql7mizxpa2vb6yk5r-gcc-wrapper-5.4.0/bin/cc option to accept ISO C89... none needed
checking for setupterm in -ltinfo... no
checking for setupterm in -lncursesw... no
checking for setupterm in -lncurses... no
checking for setupterm in -lcurses... no
configure: error: in `/run/user/1000/stack10060/terminfo-0.4.1.0':
configure: error: curses library not found, so this package cannot be built
See `config.log' for more details

Here is ~/Projects/bancot/stack.yaml:

resolver: lts-8.20
packages:
- '.'
extra-deps: []
flags: {}
extra-package-dbs: []

Here is ~/.stack/config.yaml:

nix:
  packages:
  - zlib
  - pcre
  - glpk
  - postgresql
  - ncurses
  enable: true
  pure: true
  system-ghc: true

I have also tried setting pure to false, but nothing changed. I do have ncurses-6.0 installed, as can be seen by the build command itself. I have also tried lts-7.24, but had the same results.

Sorry if this is old news for you, I can't seem to find anything related to this on the other issues.
Thank you in advance.

Most helpful comment

I can confirm that using the following .stack/config.yaml:

system-ghc: true
nix:
  enable: true
  packages: [ gcc ncurses ]

I can build terminfo-0.4.1.0 with stack (and then also intero).
The "gcc" entry in the packages field above seems mandatory — with only "ncurses" building terminfo fails with the reported curses problem.

All 5 comments

I imagine you guys must be pretty busy, is there any more information I can get to help with this issue or anything I could try to fix this (I'm just an amateur with Nix, but if there any pointers on where to look and learn maybe I could help anyway).

@mzabani This comment seems to be the workaround.

Actually, I'm not sure this is even actually a bug - It's just that the terminfo package has a surprising set of native dependencies. We may want to file an issue at terminfo to add some documentation for this.

Upon further experimentation, it seems that you only need the ncurses and gcc Nix packages.

@chris-martin It doesn't solve the problem for me.

I can confirm that using the following .stack/config.yaml:

system-ghc: true
nix:
  enable: true
  packages: [ gcc ncurses ]

I can build terminfo-0.4.1.0 with stack (and then also intero).
The "gcc" entry in the packages field above seems mandatory — with only "ncurses" building terminfo fails with the reported curses problem.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bitemyapp picture bitemyapp  Â·  3Comments

sjakobi picture sjakobi  Â·  3Comments

Toxaris picture Toxaris  Â·  4Comments

rrnewton picture rrnewton  Â·  4Comments

cybaj picture cybaj  Â·  3Comments