NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.42k stars 13.63k forks source link

haskellPackages.ghc-mod is broken #36604

Closed mrVanDalo closed 6 years ago

mrVanDalo commented 6 years ago

Issue description

I did a nixos-rebuild switch --upgrade today and got this :

building path(s) ‘/nix/store/axlbixj05zcb4x29ji4vzg1hbsjw345g-ghc-mod-5.8.0.0’, ‘/nix/store/hz9v4drabinyvh623ypahgqlb7a5l5hj-ghc-mod-5.8.0.0-data’, ‘/nix/store/q5wd6b13k4bkd9q5yf6s3xvbvp5c83l0-ghc-mod-5.8.0.0-doc’
setupCompilerEnvironmentPhase
Build with /nix/store/27k61s37i4100x2148h6w4n8gbny8lx9-ghc-8.0.2.
unpacking sources
unpacking source archive /nix/store/vq4zl3c2hhn78vqqpqsdp1466wl1iniq-ghc-mod-5.8.0.0.tar.gz
source root is ghc-mod-5.8.0.0
setting SOURCE_DATE_EPOCH to timestamp 1495938286 of file ghc-mod-5.8.0.0/test/TestUtils.hs
patching sources
Replace Cabal file with edited version from http://hackage.haskell.org/package/ghc-mod-5.8.0.0/revision/1.cabal.
compileBuildDriverPhase
setupCompileFlags: -package-db=/tmp/nix-build-ghc-mod-5.8.0.0.drv-0/package.conf.d -j1 -threaded
[1 of 1] Compiling Main             ( Setup.hs, /tmp/nix-build-ghc-mod-5.8.0.0.drv-0/Main.o )
Linking Setup ...
configuring
configureFlags: --verbose --prefix=/nix/store/axlbixj05zcb4x29ji4vzg1hbsjw345g-ghc-mod-5.8.0.0 --libdir=$prefix/lib/$compiler --libsubdir=$pkgid --datadir=/nix/store/hz9v4drabinyvh623ypahgqlb7a5l5hj-ghc-mod-5.8.0.0-data/share/ghc-8.0.2 --docdir=/nix/store/q5wd6b13k4bkd9q5yf6s3xvbvp5c83l0-ghc-mod-5.8.0.0-doc/share/doc --with-gcc=gcc --package-db=/tmp/nix-build-ghc-mod-5.8.0.0.drv-0/package.conf.d --ghc-option=-optl=-Wl,-rpath=/nix/store/axlbixj05zcb4x29ji4vzg1hbsjw345g-ghc-mod-5.8.0.0/lib/ghc-8.0.2/ghc-mod-5.8.0.0 --ghc-option=-j1 --disable-split-objs --disable-library-profiling --disable-profiling --enable-shared --disable-coverage --enable-library-vanilla --enable-executable-dynamic --disable-tests --ghc-option=-split-sections
Configuring ghc-mod-5.8.0.0...
Setup: Encountered missing dependencies:
hlint >=2.0.8 && <2.1
builder for ‘/nix/store/xdyxp554dw79va7g8k529x1cxnn0560w-ghc-mod-5.8.0.0.drv’ failed with exit code 1

Steps to reproduce

nixos-rebuild switch --upgrade and nix-shell -p haskellPackages.ghc-mod (I guess)

Technical details

 - system: `"x86_64-linux"`
 - host os: `Linux 4.9.85, NixOS, 17.09.3109.48a76ca6f57 (Hummingbird)`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 1.11.16`
 - channels(root): `"nixos-17.09.3145.df691948987"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs`
rsoeldner commented 6 years ago

I have the same problem, someone can help finding a fix ?

fpletz commented 6 years ago

cc @peti

jluttine commented 6 years ago

I suppose the correct solution would be to raise the upper bound limits of the dependency versions upstream:

"As for the over-restrictive bounds I'd be happy to merge a PR that just bumps the related dependencies if you tested that everything builds and works with them."

https://github.com/DanielG/ghc-mod/pull/928#issuecomment-368343343

peti commented 6 years ago

Fixed by https://github.com/NixOS/nixpkgs/commit/c665fcca9e7be8cd06c1f3c5bbe2b00d4c8f2a92.

fpletz commented 6 years ago

@peti ghc-mod is also broken on master and 18.03. Could you maybe also take a look?

these derivations will be built:
  /nix/store/zsqmaym21dfa4r5kbkwbj4xy8rx0w3xh-ghc-mod-5.8.0.0.drv
building '/nix/store/zsqmaym21dfa4r5kbkwbj4xy8rx0w3xh-ghc-mod-5.8.0.0.drv'...
setupCompilerEnvironmentPhase
Build with /nix/store/kl50jjg6740c8dqpb0p62pfi6n9lvcn7-ghc-8.2.2.
unpacking sources
unpacking source archive /nix/store/vq4zl3c2hhn78vqqpqsdp1466wl1iniq-ghc-mod-5.8.0.0.tar.gz
source root is ghc-mod-5.8.0.0
setting SOURCE_DATE_EPOCH to timestamp 1495938286 of file ghc-mod-5.8.0.0/test/TestUtils.hs
patching sources
Replace Cabal file with edited version from http://hackage.haskell.org/package/ghc-mod-5.8.0.0/revision/1.cabal.
compileBuildDriverPhase
setupCompileFlags: -package-db=/build/package.conf.d -j4 -threaded
[1 of 1] Compiling Main             ( Setup.hs, /build/Main.o )

Setup.hs:85:60: error:
    • Couldn't match expected type ‘UnitId’
                  with actual type ‘PathTemplate’
    • In the third argument of ‘substPathTemplate’, namely
        ‘(progPrefix lbi)’
      In the expression:
        substPathTemplate (packageId pd) lbi (progPrefix lbi)
      In an equation for ‘progprefix’:
          progprefix = substPathTemplate (packageId pd) lbi (progPrefix lbi)
   |
85 |         progprefix = substPathTemplate (packageId pd) lbi (progPrefix lbi)
   |                                                            ^^^^^^^^^^^^^^

Setup.hs:86:60: error:
    • Couldn't match expected type ‘UnitId’
                  with actual type ‘PathTemplate’
    • In the third argument of ‘substPathTemplate’, namely
        ‘(progSuffix lbi)’
      In the expression:
        substPathTemplate (packageId pd) lbi (progSuffix lbi)
      In an equation for ‘progsuffix’:
          progsuffix = substPathTemplate (packageId pd) lbi (progSuffix lbi)
   |
86 |         progsuffix = substPathTemplate (packageId pd) lbi (progSuffix lbi)
   |                                                            ^^^^^^^^^^^^^^

Setup.hs:87:28: error:
    • Couldn't match expected type ‘[a]’
                  with actual type ‘PathTemplate -> FilePath’
    • Probable cause: ‘progprefix’ is applied to too few arguments
      In the first argument of ‘(++)’, namely ‘progprefix’
      In the expression: progprefix ++ exeName exe ++ progsuffix
      In an equation for ‘fixedExeBaseName’:
          fixedExeBaseName = progprefix ++ exeName exe ++ progsuffix
    • Relevant bindings include
        fixedExeBaseName :: [a] (bound at Setup.hs:87:9)
   |
87 |         fixedExeBaseName = progprefix ++ exeName exe ++ progsuffix
   |                            ^^^^^^^^^^

Setup.hs:87:42: error:
    • Couldn't match expected type ‘[a]’
                  with actual type ‘Distribution.Types.UnqualComponentName.UnqualComponentName’
    • In the first argument of ‘(++)’, namely ‘exeName exe’
      In the second argument of ‘(++)’, namely
        ‘exeName exe ++ progsuffix’
      In the expression: progprefix ++ exeName exe ++ progsuffix
    • Relevant bindings include
        fixedExeBaseName :: [a] (bound at Setup.hs:87:9)
   |
87 |         fixedExeBaseName = progprefix ++ exeName exe ++ progsuffix
   |                                          ^^^^^^^^^^^

Setup.hs:87:57: error:
    • Couldn't match expected type ‘[a]’
                  with actual type ‘PathTemplate -> FilePath’
    • Probable cause: ‘progsuffix’ is applied to too few arguments
      In the second argument of ‘(++)’, namely ‘progsuffix’
      In the second argument of ‘(++)’, namely
        ‘exeName exe ++ progsuffix’
      In the expression: progprefix ++ exeName exe ++ progsuffix
    • Relevant bindings include
        fixedExeBaseName :: [a] (bound at Setup.hs:87:9)
   |
87 |         fixedExeBaseName = progprefix ++ exeName exe ++ progsuffix
   |                                                         ^^^^^^^^^^

Setup.hs:92:26: error:
    • Couldn't match expected type ‘Distribution.Types.UnqualComponentName.UnqualComponentName’
                  with actual type ‘[Char]’
    • In the second argument of ‘(==)’, namely ‘"ghc-mod-real"’
      In the first argument of ‘when’, namely
        ‘(exeName exe == "ghc-mod-real")’
      In the expression: when (exeName exe == "ghc-mod-real")
   |
92 |     when (exeName exe == "ghc-mod-real") $ do
   |                          ^^^^^^^^^^^^^^
builder for '/nix/store/zsqmaym21dfa4r5kbkwbj4xy8rx0w3xh-ghc-mod-5.8.0.0.drv' failed with exit code 1
error: build of '/nix/store/zsqmaym21dfa4r5kbkwbj4xy8rx0w3xh-ghc-mod-5.8.0.0.drv' failed
peti commented 6 years ago

Unfortunately, those problems are harder to fix. Note that master is based on GHC 8.2.x (while release-17.09 still uses GHC 8.0.x), and it appears that ghc-mod does not support that newer compiler. I might be wrong, of course, but that's what it looks like. IMHO, those build failures have to be fixed upstream.

fpletz commented 6 years ago

Okay, thanks!

wizzup commented 6 years ago

ghc-mod is still broken as of today. Should it be marked as broken until it become usable again? (Is it possible to do?)

$ nix-shell -p haskellPackages.ghc-mod -I 'nixpkgs=https://github.com/NixOS/nixpkgs/archive/master.tar.gz'  

builder for '/nix/store/d5vjvp0yx9q9wns1gvzl05nrfqssxfn9-cabal-helper-0.8.1.2.drv' failed with exit code 1                                                                                            
cannot build derivation '/nix/store/hplbi5wsyr1wdpz6dw5aqn95kg6crj2d-ghc-mod-5.8.0.0.drv': 1 dependencies couldn't be built                                                                           
error: build of '/nix/store/hplbi5wsyr1wdpz6dw5aqn95kg6crj2d-ghc-mod-5.8.0.0.drv' failed
andir commented 5 years ago

Still broken in two different ways on 18.09 and unstable (channel) as of today. :/

$ nix run -f channel:nixos-unstable pkgs.haskellPackages.ghc-mod

builder for '/nix/store/ddr3fnswk05xpllfqva499aca8j2538f-ghc-mod-5.8.0.0.drv' failed with exit code 1; last 10 log lines:
  Setup.hs:92:26: error:
      • Couldn't match expected type ‘Distribution.Types.UnqualComponentName.UnqualComponentName’
                    with actual type ‘[Char]’
      • In the second argument of ‘(==)’, namely ‘"ghc-mod-real"’
        In the first argument of ‘when’, namely
          ‘(exeName exe == "ghc-mod-real")’
        In the expression: when (exeName exe == "ghc-mod-real")
     |
  92 |     when (exeName exe == "ghc-mod-real") $ do
     |                          ^^^^^^^^^^^^^^
[5 built (1 failed), 184 copied (2660.9 MiB), 224.5 MiB DL]
error: build of '/nix/store/ddr3fnswk05xpllfqva499aca8j2538f-ghc-mod-5.8.0.0.drv' failed
$ nix run -f channel:nixos-18.09 pkgs.haskellPackages.ghc-mod

builder for '/nix/store/1703hwn599nwc393pkdilxn24rn16p89-cabal-helper-0.8.1.2.drv' failed with exit code 1; last 10 log lines:
    die', called at ./Distribution/Simple/Configure.hs:958:20 in Cabal-2.2.0.1-302vnEvwKgd3FEKLIV6HbI:Distribution.Simple.Configure
    configureFinalizedPackage, called at ./Distribution/Simple/Configure.hs:462:12 in Cabal-2.2.0.1-302vnEvwKgd3FEKLIV6HbI:Distribution.Simple.Configure
    configure, called at ./Distribution/Simple.hs:596:20 in Cabal-2.2.0.1-302vnEvwKgd3FEKLIV6HbI:Distribution.Simple
    confHook, called at ./Distribution/Simple/UserHooks.hs:67:5 in Cabal-2.2.0.1-302vnEvwKgd3FEKLIV6HbI:Distribution.Simple.UserHooks
    configureAction, called at ./Distribution/Simple.hs:178:19 in Cabal-2.2.0.1-302vnEvwKgd3FEKLIV6HbI:Distribution.Simple
    defaultMainHelper, called at ./Distribution/Simple.hs:115:27 in Cabal-2.2.0.1-302vnEvwKgd3FEKLIV6HbI:Distribution.Simple
    defaultMain, called at Setup.hs:2:8 in main:Main
  Setup: Encountered missing dependencies:
  pretty-show >=1.8.1 && <1.9, temporary >=1.2.1 && <1.3
cannot build derivation '/nix/store/x7acqkrr3yh8d77iglp3338350jjxs9z-ghc-mod-5.8.0.0.drv': 1 dependencies couldn't be built
[0 built (1 failed)]
error: build of '/nix/store/x7acqkrr3yh8d77iglp3338350jjxs9z-ghc-mod-5.8.0.0.drv' failed
pbogdan commented 5 years ago

AFAIK threre's no upstream release supporting GHC 8.4.x. I'm building ghc-mod and cabal-helper from alanz' unofficial forks and it seems to work well enough on 18.09 (https://github.com/DanielG/ghc-mod/issues/931).

mrVanDalo commented 5 years ago

I switched to use vscode + hie but it would be nice to have the ghc-mod running again. The Language Server Protocol is a nice thing too.

(just posting this for people who want to find a quick alternative)

wizzup commented 5 years ago

I use this hack and this expression to steal hie's ghc-mod.

# hie_ghc-mod.nix
{ pkgs ? import <nixpkgs> {} }:
with pkgs;

let
  hie-nix = fetchFromGitHub {
      owner = "wizzup";
      repo = "hie-nix";
      rev = "279a9bb8baad82ea20f18056420b58ce763ee4ad";
      sha256 = "1j6763lzgif3wrz28gjsqp201r75rlf7gc3sjhcfa1ix74z0a6ds";
    };

  ghc-mod84 = (import hie-nix { }).ghc-mod84;
in
  mkShell {
    name = "haskell-sh";
    buildInputs = [ ghc-mod84 hlint ghc ];

    shellHook = ''
      eval "$(egrep ^export "$(type -p ghc)")"
      export PS1=$'\[\033[1;32m\][$name\u2234\W]\n$ \[\033[0m\]'
    '';
  }
$ nix-shell hie_ghc-mod.nix --run 'ghc-mod --version'
ghc-mod version 5.9.0.0 compiled by GHC 8.4.3

It is a bad hack, used to be easier, binary cache doesn't seem to be working but it still better than nothing

I have no idea why hie is able to get ghc-mod working but nixpkgs is not. Maybe it is because different package source (stackage vs hackage).