DanielG/ghc-mod

Not possible to install ghc-mod on Windows

freeman42x opened this issue · 4 comments

Installing fails both with cabal and with stack.

cabal install error:

Microsoft Windows [Version 10.0.17134.407]
(c) 2018 Microsoft Corporation. All rights reserved.

C:\Users\Razvan>cabal --version
cabal-install version 2.2.0.0
compiled using version 2.2.0.1 of the Cabal library

C:\Users\Razvan>cabal install ghc-mod
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: ghc-mod-5.8.0.0 (user goal)
[__1] trying: syb-0.7 (dependency of ghc-mod)
[__2] next goal: base (dependency of ghc-mod)
[__2] rejecting: base-4.11.1.0/installed-4.1... (conflict: ghc-mod =>
base<4.10 && >=4.6.0.1)
[__2] rejecting: base-4.12.0.0, base-4.11.1.0, base-4.11.0.0, base-4.10.1.0,
base-4.10.0.0, base-4.9.1.0, base-4.9.0.0, base-4.8.2.0, base-4.8.1.0,
base-4.8.0.0, base-4.7.0.2, base-4.7.0.1, base-4.7.0.0, base-4.6.0.1,
base-4.6.0.0, base-4.5.1.0, base-4.5.0.0, base-4.4.1.0, base-4.4.0.0,
base-4.3.1.0, base-4.3.0.0, base-4.2.0.2, base-4.2.0.1, base-4.2.0.0,
base-4.1.0.0, base-4.0.0.0, base-3.0.3.2, base-3.0.3.1 (constraint from
non-upgradeable package requires installed instance)
[__2] fail (backjumping, conflict set: base, ghc-mod)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: base, ghc-mod, syb

stack install error:

C:\Users\Razvan>stack install ghc-mod
WARNING: Ignoring out of range dependency (allow-newer enabled): Cabal-2.2.0.1. ghc-mod requires: >=1.18 && <1.25
WARNING: Ignoring out of range dependency (allow-newer enabled): base-4.11.1.0. ghc-mod requires: >=4.6.0.1 && <4.10
WARNING: Ignoring out of range dependency (allow-newer enabled): Cabal-2.2.0.1. cabal-helper requires: >=1.14 && <1.25
WARNING: Ignoring out of range dependency (allow-newer enabled): process-1.6.3.0. cabal-helper requires: >=1.1.0.1 && <1.5
WARNING: Ignoring out of range dependency (allow-newer enabled): temporary-1.3. cabal-helper requires: <1.3 && >=1.2.0.4
WARNING: Ignoring out of range dependency (allow-newer enabled): extra-1.6.13. ghc-mod requires: <1.6 && >=1.4
WARNING: Ignoring out of range dependency (allow-newer enabled): ghc-8.4.4. ghc-mod requires: >=7.6 && <8.2
WARNING: Ignoring out of range dependency (allow-newer enabled): ghc-8.4.4. ghc-syb-utils requires: >=7.0 && <8.4
WARNING: Ignoring out of range dependency (allow-newer enabled): haskell-src-exts-1.20.3. ghc-mod requires: <1.20 && >=1.18
WARNING: Ignoring out of range dependency (allow-newer enabled): hlint-2.1.10. ghc-mod requires: <2.1 && >=2.0.8
WARNING: Ignoring out of range dependency (allow-newer enabled): monad-journal-0.8.1. ghc-mod requires: <0.8 && >=0.4
WARNING: Ignoring out of range dependency (allow-newer enabled): optparse-applicative-0.14.3.0. ghc-mod requires: >=0.13.0.0 && <0.14
WARNING: Ignoring out of range dependency (allow-newer enabled): temporary-1.3. ghc-mod requires: <1.3 && >=1.2.0.3
haskell-src-exts-1.20.3: using precompiled package
ghc-syb-utils-0.2.3.3: configure
haskell-src-exts-util-0.2.4: using precompiled package
ghc-syb-utils-0.2.3.3: build
djinn-ghc-0.0.2.3: configure
djinn-ghc-0.0.2.3: build
cabal-helper-0.7.3.0: configure
Could not find custom-setup dep: Cabal
hlint-2.1.10: configure
djinn-ghc-0.0.2.3: copy/register
hlint-2.1.10: build
hlint-2.1.10: copy/register
Progress 6/7

-- While building package cabal-helper-0.7.3.0 using:
C:\Users\Razvan\AppData\Local\Programs\stack\x86_64-windows\ghc-8.4.4\bin\ghc.EXE --make -odir C:\Users\Razvan\AppData\Local\Temp\stack7296\cabal-helper-0.7.3.0.stack-work\dist\7d103d30\setup -hidir C:\Users\Razvan\AppData\Local\Temp\stack7296\cabal-helper-0.7.3.0.stack-work\dist\7d103d30\setup -i -i. -clear-package-db -global-package-db -package-db=C:\sr\snapshots\d726c829\pkgdb -package-db=C:\sr\global-project.stack-work\install\01042f5d\pkgdb -hide-all-packages -package=Cabal -package-id=base-4.11.1.0 -package-id=containers-0.5.11.0 -package-id=directory-1.3.1.5 -package-id=filepath-1.4.2 -package-id=process-1.6.3.0 -package-id=template-haskell-2.13.0.0 -package-id=transformers-0.5.5.0 -optP-include -optPC:\Users\Razvan\AppData\Local\Temp\stack7296\cabal-helper-0.7.3.0.stack-work\dist\7d103d30\setup\setup_macros.h C:\Users\Razvan\AppData\Local\Temp\stack7296\cabal-helper-0.7.3.0\Setup.hs C:\sr\setup-exe-src\setup-shim-Z6RU0evB.hs -main-is StackSetupShim.mainOverride -o C:\Users\Razvan\AppData\Local\Temp\stack7296\cabal-helper-0.7.3.0.stack-work\dist\7d103d30\setup\setup -threaded
Process exited with code: ExitFailure 1
Logs have been written to: C:\sr\global-project.stack-work\logs\cabal-helper-0.7.3.0.log

[1 of 2] Compiling Main             ( C:\Users\Razvan\AppData\Local\Temp\stack7296\cabal-helper-0.7.3.0\Setup.hs, C:\Users\Razvan\AppData\Local\Temp\stack7296\cabal-helper-0.7.3.0\.stack-work\dist\7d103d30\setup\Main.o )

C:\Users\Razvan\AppData\Local\Temp\stack7296\cabal-helper-0.7.3.0\Setup.hs:87: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)
   |
87 |         progprefix = substPathTemplate (packageId pd) lbi (progPrefix lbi)
   |                                                            ^^^^^^^^^^^^^^

C:\Users\Razvan\AppData\Local\Temp\stack7296\cabal-helper-0.7.3.0\Setup.hs:88: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)
   |
88 |         progsuffix = substPathTemplate (packageId pd) lbi (progSuffix lbi)
   |                                                            ^^^^^^^^^^^^^^

C:\Users\Razvan\AppData\Local\Temp\stack7296\cabal-helper-0.7.3.0\Setup.hs:89: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 C:\Users\Razvan\AppData\Local\Temp\stack7296\cabal-helper-0.7.3.0\Setup.hs:89:9)
   |
89 |         fixedExeBaseName = progprefix ++ exeName exe ++ progsuffix
   |                            ^^^^^^^^^^

C:\Users\Razvan\AppData\Local\Temp\stack7296\cabal-helper-0.7.3.0\Setup.hs:89: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 C:\Users\Razvan\AppData\Local\Temp\stack7296\cabal-helper-0.7.3.0\Setup.hs:89:9)
   |
89 |         fixedExeBaseName = progprefix ++ exeName exe ++ progsuffix
   |                                          ^^^^^^^^^^^

C:\Users\Razvan\AppData\Local\Temp\stack7296\cabal-helper-0.7.3.0\Setup.hs:89: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 C:\Users\Razvan\AppData\Local\Temp\stack7296\cabal-helper-0.7.3.0\Setup.hs:89:9)
   |
89 |         fixedExeBaseName = progprefix ++ exeName exe ++ progsuffix
   |                                                         ^^^^^^^^^^

-- While building package ghc-syb-utils-0.2.3.3 using:
C:\sr\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_2.2.0.1_ghc-8.4.4.exe --builddir=.stack-work\dist\7d103d30 build --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"
Process exited with code: ExitFailure 1
Logs have been written to: C:\sr\global-project.stack-work\logs\ghc-syb-utils-0.2.3.3.log

Configuring ghc-syb-utils-0.2.3.3...
Preprocessing library for ghc-syb-utils-0.2.3.3..
Building library for ghc-syb-utils-0.2.3.3..
[1 of 1] Compiling GHC.SYB.Utils    ( GHC\SYB\Utils.hs, .stack-work\dist\7d103d30\build\GHC\SYB\Utils.o )

GHC\SYB\Utils.hs:258:64: error:
    * Could not deduce (HasSourceText (XHsChar RdrName))
        arising from a use of `ppr'
      from the context: Data a
        bound by the type signature for:
                   showData :: forall a. Data a => Stage -> Int -> a -> String
        at GHC\SYB\Utils.hs:229:1-49
    * In the second argument of `(.)', namely `ppr'
      In the second argument of `(.)', namely `showSDoc_ . ppr'
      In the second argument of `(.)', namely
        `(++ "}") . showSDoc_ . ppr'
    |
258 |         overLit    = ("{HsOverLit:"++) . (++"}") . showSDoc_ . ppr
    |                                                                ^^^

GHC\SYB\Utils.hs:261:73: error:
    * Could not deduce (Data (XHsChar RdrName))
        arising from a use of `list'
      from the context: Data a
        bound by the type signature for:
                   showData :: forall a. Data a => Stage -> Int -> a -> String
        at GHC\SYB\Utils.hs:229:1-49
    * In the first argument of `(.)', namely `list'
      In the second argument of `(.)', namely `list . bagToList'
      In the second argument of `(.)', namely
        `(++ "}") . list . bagToList'
    |
261 |         bagRdrName = ("{Bag(Located (HsBind RdrName)): "++) . (++"}") . list . bagToList
    |                                                                         ^^^^

GHC\SYB\Utils.hs:263:70: error:
    * Could not deduce (Data (XHsChar Name))
        arising from a use of `list'
      from the context: Data a
        bound by the type signature for:
                   showData :: forall a. Data a => Stage -> Int -> a -> String
        at GHC\SYB\Utils.hs:229:1-49
    * In the first argument of `(.)', namely `list'
      In the second argument of `(.)', namely `list . bagToList'
      In the second argument of `(.)', namely
        `(++ "}") . list . bagToList'
    |
263 |         bagName    = ("{Bag(Located (HsBind Name)): "++) . (++"}") . list . bagToList
    |                                                                      ^^^^

GHC\SYB\Utils.hs:265:69: error:
    * Could not deduce (Data (XHsChar Var))
        arising from a use of `list'
      from the context: Data a
        bound by the type signature for:
                   showData :: forall a. Data a => Stage -> Int -> a -> String
        at GHC\SYB\Utils.hs:229:1-49
    * In the first argument of `(.)', namely `list'
      In the second argument of `(.)', namely `list . bagToList'
      In the second argument of `(.)', namely
        `(++ "}") . list . bagToList'
    |
265 |         bagVar     = ("{Bag(Located (HsBind Var)): "++) . (++"}") . list . bagToList
    |

Unfortunately ghc-mod doesn't currently work with anything above GHC 8.2 and likely never will. We're currently working on moving efforts to haskell-ide-engine instead. Sorry about that.

@DanielG I was aware of that. But then why are broken version been published both to cabal and stackage?

The version on Hackage is just fine, note the

rejecting: base-4.11.1.0/installed-4.1... (conflict: ghc-mod =>
base<4.10 && >=4.6.0.1)

in your cabal install output above. base-4.11 is the base package that came with GHC 8.4 and the constraint on ghc-mod correctly states base<4.10 which corresponds to GHC 8.2 which the package on Hackage doesn't support.

I think the build errors with stack are a red herring because ghc-mod isn't even in Stackage anymore and in that case Stack seems to fall back to ignoring all the dependency bounds for some reason, cf the WARNING: Ignoring out of range dependency (allow-newer enabled) stuff in the stack install output.

@DanielG Thank you for the clarification. I hope they will be useful for someone running in the same issues later.