Open runeksvendsen opened 8 years ago
Also getting this on Stack 1.0.4.3
on Linux (same other versions)
@runeksvendsen @declension - I've seen this issue before - https://github.com/commercialhaskell/stack/issues/1793
The most obvious problem is that ghc-mod
seems to think you are using cabal
when in reality you are using stack
. I'll bring this up in the issue I referenced above. We might also need to report an issue upstream to ghc-mod
.
@carymrobbins thanks, - it now seems to be working for me. Other than upgrading hlint (as per #286) which shouldn't make any difference, the only thing I then did was to delete ./dist/setup-config
.
Weird, and I'd never have thought / known to try that, but for now ghc-mod
is working for me again in Haskforce - so thanks :)
Well done! @runeksvendsen - you might also want to delete any dist/
directories you have in the project to ensure ghc-mod
isn't using them to infer cabal
usage.
So I'm getting this, as well as a few others. I've installed all tools through stack. And HaskForce found them automatically, but get the following issues.
7:00 PM ghc-modi error
Unable to parse problems from ghc-modi: cabal: Use of GHC's environment variable GHC_PACKAGE_PATH is incompatible with
Cabal. Use the flag --package-db to specify a package database (it can be used
multiple times).
ghc-mod: readCreateProcess: cabal "configure" "--with-ghc=ghc" "--flags" "" (exit 1): failed
Configure
7:00 PM ghc-modi error
Killing ghc-modi due to process failure.
You can restart it using Tools > Restart ghc-modi
Executing ghc-modi command 'check /Users/alexisvincent/Documents/Code/Projects/haskell/cis194/src/HW2/LogAnalysis.hs' failed with error: Failed to write command to ghc-modi:
Configure
7:03 PM Haskell Tools
Nonzero exit status (1) from command: /Users/alexisvincent/.local/bin/stylish-haskell --version
Process stderr: Invalid option `--version'
Usage: stylish-haskell [FILENAME]
Under the following build of IDEA
IntelliJ IDEA 2016.2.1 EAP
Build #IU-162.1447.7, built on July 20, 2016
Licensed to Alexis Vincent
Subscription is active until January 30, 2017
For educational use only.
JRE: 1.8.0_76-release-b216 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Although I was getting the issues with 2016.2 EAP as well
@alexisvincent - Have you tried deleting all of the dist directories in your project? If you are on a Unix system, the following should work.
% find . -name dist -type d
If the listed directories are ok to delete, delete them with -
% find . -name dist -type d -exec rm -rf {} \;
I remember that at some point, I could fix the problem by deleting the 'dist' directory, but this doesn't work any more.
I should probably also note that running the commands that Haskforce run, works fine manually, in a terminal:
rune@Runes-MacBook-Pro:~/IdeaProjects/blockchain-restful-address-index$ /Users/rune/.local/bin/stack exec -- /Users/rune/.stack/snapshots/x86_64-osx/lts-6.4/7.10.3/bin/ghc-mod legacy-interactive
check /Users/rune/IdeaProjects/blockchain-restful-address-index/src/Main.hs
OK
Same command from within IntelliJ (output from "Haskell Tools Console"):
Using working directory: /Users/rune/IdeaProjects/blockchain-restful-address-index
Starting ghc-modi process: /Users/rune/.local/bin/stack exec -- /Users/rune/.stack/snapshots/x86_64-osx/lts-6.4/7.10.3/bin/ghc-mod legacy-interactive
check /Users/rune/IdeaProjects/blockchain-restful-address-index/src/Main.hs
cabal: Use of GHC's environment variable GHC_PACKAGE_PATH is incompatible with
Cabal. Use the flag --package-db to specify a package database (it can be used
multiple times).
ghc-mod: readCreateProcess: cabal "configure" "--with-ghc=ghc" "--flags" "" (exit 1): failed
@DanielG - Do you have any idea why this may happen? This seems rather bizarre to me.
Quoting from the output above:
/Users/rune/.local/bin/stack exec -- /Users/rune/.stack/snapshots/x86_64-osx/lts-6.4/7.10.3/bin/ghc-mod legacy-interactive check /Users/rune/IdeaProjects/blockchain-restful-address-index/src/Main.hs
stack exec
sets the GHC_PACKAGE_PATH envvar and cabal-install added this error around 1.24 (IIRC). This has been popping up all over the place in the last few months.
The only thing that seems plausible here since dist/
is already gone is stack
not being in ghc-mod's PATH
, in that case it will fall through to using Cabal.
In the upcoming 5.6 release I have reworked the project detection code a bit. ghc-mod now takes various environment variables set by Stack as a very strong hint to use it instead of cabal so that new version should complain loudly about this case. (Package candidate, Install using cabal install https://hackage.haskell.org/package/ghc-mod-5.6.0.0/candidate/ghc-mod-5.6.0.0.tar.gz
)
@carymrobbins running your command fixed my issue. However, now, gcc-modi is complaining with the following:
8:10 AM ghc-modi error
Killing ghc-modi due to process failure.
You can restart it using Tools > Restart ghc-modi
Executing ghc-modi command 'check /Users/alexisvincent/Documents/Code/Projects/haskell/cis194/src/HW1/CardValidation.hs' failed with error: Failed to write command to ghc-modi:
Configure
8:10 AM ghc-modi error
Unable to parse problems from ghc-modi: ghc-mod: cabal: readCreateProcess: runInteractiveProcess: exec: does not exist (No such file or directory)
Which is partly what I had before, with a new extra.
@DanielG Wonderful! ghc-mod 5.6.0.0 fixes it for me.
Now HaskForce just needs to be able to parse the new warning from ghc-mod (perhaps it should ignore all lines starting with "Warning:"?).
Using working directory: /Users/rune/IdeaProjects/blockchain-restful-address-index
Starting ghc-modi process: /Users/rune/.local/bin/stack exec -- /Users/rune/.local/bin/ghc-mod legacy-interactive
check /Users/rune/IdeaProjects/blockchain-restful-address-index/src/Main.hs
Warning: STACK_EXE set, preferring Stack project
Unable to parse problems from ghc-modi: Warning: STACK_EXE set, preferring Stack project
check /Users/rune/IdeaProjects/blockchain-restful-address-index/src/Lib.hs
<empty message>
check /Users/rune/IdeaProjects/blockchain-restful-address-index/src/Config.hs
<empty message>
check /Users/rune/IdeaProjects/blockchain-restful-address-index/src/Lib.hs
src/Lib.hs:67:10:Not in scope: ‘potato’
A few notes that might be useful for someone:
ln -s /usr/local/bin/stack /Users/andreysergienko/.local/bin/
After all, it seems to be working as expected.
p.s. ghc-mod 5.6.0.0, stack 1.2.2_3
I just opened https://github.com/carymrobbins/intellij-haskforce/issues/318 which is related to the problem @fycth describes. I was able to get around it by patching the PATH that IntelliJ uses when spawning ghc-modi
.
Hello
I'm experiencing the following error in IntelliJ 2016.1.3 (Build #IU-145.1617) on OSX, with the newest HaskForce (0.3-beta.35), ghc-mod version 5.5.0.0, stack 1.1.2 and GHC 7.10.3:
I really have no idea what's going on here, so please let me know if there is additional information I can provide that will help solve this. Or if you can point me in a direction, maybe I can solve it myself.
The project files are available here: https://github.com/runeksvendsen/blockchain-restful-address-index (the
.idea
folder is there, too, in case it's relevant).