Closed waddlaw closed 4 years ago
Well, there is a comment explaining it:
-- The command `cabal v2-exec -v0 ghc` only works if the project has been
-- built already.
-- This command must work though before the project is build.
-- Therefore, fallback to "ghc" on the path.
So, this is a stack multi-cradle? What is the content of your hie.yaml
?
Or your stack.yaml
? It seems that the project does not agree on the ghc version to use, see 8.8.1
everywhere, but the hie version has been compiled with 8.6.5
Thank you for quick reply!
My project specifies -w ghc-8.8.1
in thecabal.project
file. However, the version of ghc installed on the system is 8.6.5. Therefore, it seems that there is a mismatch in ghc version detection.
Changing the system ghc version to 8.8.1 will fix it.
The content of the hie.yaml
file:
cradle:
multi:
# stack
- path: "./app/Main.hs"
config: { cradle: {stack: {component: "hie-bug:exe:hie-bug-exe"}} }
- path: "./src"
config: { cradle: {stack: {component: "hie-bug:lib"}} }
- path : "./test"
config: { cradle: {stack: {component: "hie-bug:test:hie-bug-test"}} }
# cabal
- path: "./app/Main.hs"
config: { cradle: {cabal: {component: "hie-bug:hie-bug-exe"}} }
- path: "./src"
config: { cradle: {cabal: {component: "lib:hie-bug"}} }
- path : "./test"
config: { cradle: {cabal: {component: "hie-bug:hie-bug-test"}} }
and stack.yaml
resolver: nightly-2020-01-19
Ok, yeah, so, this is a missing feature. If you only specified stack cradles, e.g. comment out the cabal cradle paths, then the right ghc version should be detected, too. Would you mind checking it?
So, the bug is that we are not honouring the cabal -w
flag. I think there is an issue for that already.
If you only specified stack cradles, e.g. comment out the cabal cradle paths, then the right ghc version should be detected, too. Would you mind checking it?
It worked correctly! Thank you. But, get this warning:
hie.yaml
is this:
cradle:
multi:
# stack
- path: "./app/Main.hs"
config: { cradle: {stack: {component: "hie-bug:exe:hie-bug-exe"}} }
- path: "./src"
config: { cradle: {stack: {component: "hie-bug:lib"}} }
- path : "./test"
config: { cradle: {stack: {component: "hie-bug:test:hie-bug-test"}} }
# cabal
# - path: "./app/Main.hs"
# config: { cradle: {cabal: {component: "hie-bug:hie-bug-exe"}} }
# - path: "./src"
# config: { cradle: {cabal: {component: "lib:hie-bug"}} }
# - path : "./test"
# config: { cradle: {cabal: {component: "hie-bug:hie-bug-test"}} }
The command
cabal v2-exec -v0 ghc
only works if the project has been built already. This command must work though before the project is build.
How about running after creating the dist-newstyle/tmp
directory?
$ ghc -V
The Glorious Glasgow Haskell Compilation System, version 8.6.5
$ mkdir dist-newstyle/tmp
$ cabal v2-exec -v0 ghc -- -V
The Glorious Glasgow Haskell Compilation System, version 8.8.1
Can I ignore this warning?
With stack, you should not produce this warning, afaict.
What is your stack.yaml
?
stack.yaml
has only one line.
resolver: nightly-2020-01-19
What are your logs if your hie.yaml
only looks like:
cradle:
stack:
- path: "./app/Main.hs"
config: { cradle: {stack: {component: "hie-bug:exe:hie-bug-exe"}} }
- path: "./src"
config: { cradle: {stack: {component: "hie-bug:lib"}} }
- path : "./test"
config: { cradle: {stack: {component: "hie-bug:test:hie-bug-test"}} }
No more warnings when upgrading hie version. hie.yaml
has not changed anything.
The current HIE
version is as follows.
$ hie --version
Version 1.1, Git revision 7283ae2eae069d15a226ff0d458007db59a00f84 (dirty) (3770 commits) x86_64 ghc-8.8.2
$ hie-8.8 --version
Version 1.1, Git revision 7283ae2eae069d15a226ff0d458007db59a00f84 (dirty) (3770 commits) x86_64 ghc-8.8.2
$ hie-8.6 --version
Version 1.0.0.0, Git revision 4bec07d79cf77c8ee855957d20e315a89f799d75 (dirty) (3745 commits) x86_64 ghc-8.6.5
@fendor. Thank you for teaching me carefully.
This repo is not working multi-cradle hie.yaml. Why this code (
else if
clause) is commented out?https://github.com/haskell/haskell-ide-engine/blob/4bec07d79cf77c8ee855957d20e315a89f799d75/hie-plugin-api/Haskell/Ide/Engine/Cradle.hs#L98-L120
HIE log: