commercialhaskell / stack

The Haskell Tool Stack
http://haskellstack.org
BSD 3-Clause "New" or "Revised" License
3.98k stars 845 forks source link

Problems with ncurses on Arch Linux #3509

Closed dschrempf closed 6 years ago

dschrempf commented 6 years ago

General summary/comments (optional)

Compiling network fails.

Steps to reproduce

stack unpack network
cd network...
stack init
stack build

Expected

The compilation succeeds.

Actual

The following error is reported:

--  While building package network-2.6.3.2 using:
      /tmp/stack19701/network-2.6.3.2/.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/setup/setup --builddir=.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0 configure --with-ghc=/home/dominik/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/bin/ghc --with-ghc-pkg=/home/dominik/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/bin/ghc-pkg --user --package-db=clear --package-db=global --package-db=/home/dominik/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.10/8.0.2/pkgdb --libdir=/home/dominik/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.10/8.0.2/lib --bindir=/home/dominik/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.10/8.0.2/bin --datadir=/home/dominik/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.10/8.0.2/share --libexecdir=/home/dominik/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.10/8.0.2/libexec --sysconfdir=/home/dominik/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.10/8.0.2/etc --docdir=/home/dominik/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.10/8.0.2/doc/network-2.6.3.2 --htmldir=/home/dominik/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.10/8.0.2/doc/network-2.6.3.2 --haddockdir=/home/dominik/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.10/8.0.2/doc/network-2.6.3.2 --dependency=base=base-4.9.1.0 --dependency=bytestring=bytestring-0.10.8.1 --dependency=unix=unix-2.7.2.1
    Process exited with code: ExitFailure 1
    Logs have been written to: /home/dominik/Population-Genetics/Programs/haskell/bmm-simulate/.stack-work/logs/network-2.6.3.2.log

    [1 of 2] Compiling Main             ( /tmp/stack19701/network-2.6.3.2/Setup.hs, /tmp/stack19701/network-2.6.3.2/.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/setup/Main.o )
    [2 of 2] Compiling StackSetupShim   ( /home/dominik/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs, /tmp/stack19701/network-2.6.3.2/.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/setup/StackSetupShim.o )
    Linking /tmp/stack19701/network-2.6.3.2/.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/setup/setup ...
    Configuring network-2.6.3.2...
    configure: WARNING: unrecognized options: --with-compiler
    checking build system type... x86_64-pc-linux-gnu
    checking host system type... x86_64-pc-linux-gnu
    checking for gcc... /usr/bin/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... configure: error: in `/tmp/stack19701/network-2.6.3.2':
    configure: error: cannot run C compiled programs.
    If you meant to cross compile, use `--host'.
    See `config.log' for more details

Stack version

Version 1.5.1 x86_64

Method of installation

Arch package repository.

Additional comments

See also: https://bbs.archlinux.org/viewtopic.php?pid=1744715#p1744715

and maybe

3487

This may also be an Arch issue. If this is the case, please let me know, I can post a bug report over there. Thank you!

mgsloan commented 6 years ago

I believe this is a duplicate of #3488 , yes please post a bug to Arch. It seems like this one and this one keep biting people. Seems like the following may help:

dschrempf commented 6 years ago

I opened an issue at Arch, please see

https://bugs.archlinux.org/task/56101

sboehler commented 6 years ago

Had the same issue. Installing ncurses-full didn't help, but I managed to get it working by including ghc-build: nopie in stack.yml (as @mgsloan suggested) and installing ncurses and ncurses5-compat-libs (the latter from AUR).

mgsloan commented 6 years ago

Thanks for reporting it upstream, @dschrempf ! Glad the workarounds are working for y'all!

BorisNikulin commented 6 years ago

I would like to add that the workarounds for my arch did not work 100%. ghc-build: nopie errored due to not finding libtinfo.so.5 which I think i got rid of (libtinfo5) while trying to find a workaround. Using ncurses-full from aur did make stack work except due to a missing libtinfo.so.6 symlink my vim did not work. Putting in the symlink broke stack but fixed vim.

However I did find my own workaround like @sboehler by using ghc-build: tinfo6 in the stack.yaml. Using that stack.yaml option and just ncurses (no ncurses5-compat-libs or ncurses-full or any symlinks) stack works as well as my vim.

It seems that including a libtinfo symlink causes stack to detect it and use a ghc version that breaks. However libtinfo is also needed for other apps like vim so it's an odd balance. Hope my workaround helps somebody.

cdepillabout commented 6 years ago

I can confirm that adding ghc-build: tinfo6 to ~/.stack/config.yaml fixed this problem for me. I didn't have to install ncurses-full or anything else.

To make this more google friendly, here was the error I was getting when trying to install network or old-time:

$ stack install --resolver lts-9.14 network
network-2.6.3.2: configure

--  While building package network-2.6.3.2 using:
      /tmp/stack30999/network-2.6.3.2/.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/setup/setup --builddir=.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0 configure --with-ghc=/home/illabout/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/bin/ghc --with-ghc-pkg=/home/illabout/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/bin/ghc-pkg --user --package-db=clear --package-db=global --package-db=/home/illabout/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.14/8.0.2/pkgdb --libdir=/home/illabout/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.14/8.0.2/lib --bindir=/home/illabout/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.14/8.0.2/bin --datadir=/home/illabout/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.14/8.0.2/share --libexecdir=/home/illabout/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.14/8.0.2/libexec --sysconfdir=/home/illabout/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.14/8.0.2/etc --docdir=/home/illabout/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.14/8.0.2/doc/network-2.6.3.2 --htmldir=/home/illabout/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.14/8.0.2/doc/network-2.6.3.2 --haddockdir=/home/illabout/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.14/8.0.2/doc/network-2.6.3.2 --dependency=base=base-4.9.1.0 --dependency=bytestring=bytestring-0.10.8.1 --dependency=unix=unix-2.7.2.1
    Process exited with code: ExitFailure 1
    Logs have been written to: /home/illabout/.stack/global-project/.stack-work/logs/network-2.6.3.2.log

    [1 of 2] Compiling Main             ( /tmp/stack30999/network-2.6.3.2/Setup.hs, /tmp/stack30999/network-2.6.3.2/.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/setup/Main.o )
    [2 of 2] Compiling StackSetupShim   ( /home/illabout/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs, /tmp/stack30999/network-2.6.3.2/.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/setup/StackSetupShim.o )
    Linking /tmp/stack30999/network-2.6.3.2/.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/setup/setup ...
    Configuring network-2.6.3.2...
    configure: WARNING: unrecognized options: --with-compiler
    checking build system type... x86_64-pc-linux-gnu
    checking host system type... x86_64-pc-linux-gnu
    checking for gcc... /usr/bin/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... configure: error: in `/tmp/stack30999/network-2.6.3.2':
    configure: error: cannot run C compiled programs.
    If you meant to cross compile, use `--host'.
    See `config.log' for more details
$ stack install --resolver lts-9.14 old-time
old-time-1.1.0.3: configure

--  While building package old-time-1.1.0.3 using:
      /tmp/stack31418/old-time-1.1.0.3/.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/setup/setup --builddir=.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0 configure --with-ghc=/home/illabout/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/bin/ghc --with-ghc-pkg=/home/illabout/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/bin/ghc-pkg --user --package-db=clear --package-db=global --package-db=/home/illabout/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.14/8.0.2/pkgdb --libdir=/home/illabout/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.14/8.0.2/lib --bindir=/home/illabout/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.14/8.0.2/bin --datadir=/home/illabout/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.14/8.0.2/share --libexecdir=/home/illabout/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.14/8.0.2/libexec --sysconfdir=/home/illabout/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.14/8.0.2/etc --docdir=/home/illabout/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.14/8.0.2/doc/old-time-1.1.0.3 --htmldir=/home/illabout/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.14/8.0.2/doc/old-time-1.1.0.3 --haddockdir=/home/illabout/.stack/snapshots/x86_64-linux-tinfo6-nopie/lts-9.14/8.0.2/doc/old-time-1.1.0.3 --dependency=base=base-4.9.1.0 --dependency=old-locale=old-locale-1.0.0.7-KGBP1BSKxH5GCm0LnZP04j
    Process exited with code: ExitFailure 1
    Logs have been written to: /home/illabout/.stack/global-project/.stack-work/logs/old-time-1.1.0.3.log

    [1 of 2] Compiling Main             ( /tmp/stack31418/old-time-1.1.0.3/Setup.hs, /tmp/stack31418/old-time-1.1.0.3/.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/setup/Main.o )
    [2 of 2] Compiling StackSetupShim   ( /home/illabout/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs, /tmp/stack31418/old-time-1.1.0.3/.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/setup/StackSetupShim.o )
    Linking /tmp/stack31418/old-time-1.1.0.3/.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/setup/setup ...
    Configuring old-time-1.1.0.3...
    configure: WARNING: unrecognized options: --with-compiler
    checking for gcc... /usr/bin/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... configure: error: in `/tmp/stack31418/old-time-1.1.0.3':
    configure: error: cannot run C compiled programs.
    If you meant to cross compile, use `--host'.
    See `config.log' for more details

Adding ghc-build: tinfo6 to ~/.stack/config.yaml completely fixed these build problems for me.

ghost commented 6 years ago

ghc-build: tinfo6 in ~/.stack/config.yaml fixed everything for me

Using the Manual Linux 64-bit Static Release

I was having trouble running stack hoogle. Random packages would fail to compile with linker errors. I tried ghc-build: nopie as well as ncurses5-compat-libs but then hoogle wouldn't compile. Currently I'm using ncurses from Arch/core.