haskell / haskell-ide-engine

The engine for haskell ide-integration. Not an IDE
BSD 3-Clause "New" or "Revised" License
2.38k stars 210 forks source link

VSCode extension emits error "Got error while processing diagnostics: <command line>: cannot satisfy -package-id base-4.9.1.0 (use -v for more information)" #1465

Open codeinred opened 4 years ago

codeinred commented 4 years ago

I recently installed haskell-ide-engine, but I get the following error when I start up vscode and open a haskell file:

Got error while processing diagnostics: <command line>: cannot satisfy -package-id base-4.9.1.0
    (use -v for more information)
Anrock commented 4 years ago

What GHC version your project uses? base-4.9.1.0 is bundled with GHC 8.0.2 and HIE doesn't support it.

codeinred commented 4 years ago

I want to use GHC 8.6.5, which is the version of GHC I have installed on my system. The project I'm having issues with is here - https://github.com/sdiehl/kaleidoscope

Is there a way I can modify the project to use the correct version of GCC, so that HIE supports it?

codeinred commented 4 years ago

Update: The problem appears even in very simple projects, such as ones created with stack new. For example, I tried loading Data.Char, and got this error:

Could not load module ‘Data.Char’
It is a member of the hidden package ‘base-4.12.0.0’.
You can run ‘:set -package base’ to expose it.
alanz commented 4 years ago

If I clone that repo and say stack build on the command line, I get an error. So the project does not build out of the box, so cannot work in hie.

$ stack build
No packages found in snapshot which provide a "llvm-config" executable, which is a build-tool dependency of llvm-hs
llvm-hs     > configure

--  While building package llvm-hs-4.0.1.0 using:
      /tmp/stack14812/llvm-hs-4.0.1.0/.stack-work/dist/x86_64-linux-tinfo6/Cabal-1.24.2.0/setup/setup --builddir=.stack-work/dist/x86_64-linux-tinfo6/Cabal-1.24.2.0 configure --user --package-db=clear --package-db=global --package-db=/home/alanz/.stack/snapshots/x86_64-linux-tinfo6/64c75b15ef9ff77a94fea2b04f6f1c62d7431c4ecc3716689f8642d0939ec98f/8.0.2/pkgdb --libdir=/home/alanz/.stack/snapshots/x86_64-linux-tinfo6/64c75b15ef9ff77a94fea2b04f6f1c62d7431c4ecc3716689f8642d0939ec98f/8.0.2/lib --bindir=/home/alanz/.stack/snapshots/x86_64-linux-tinfo6/64c75b15ef9ff77a94fea2b04f6f1c62d7431c4ecc3716689f8642d0939ec98f/8.0.2/bin --datadir=/home/alanz/.stack/snapshots/x86_64-linux-tinfo6/64c75b15ef9ff77a94fea2b04f6f1c62d7431c4ecc3716689f8642d0939ec98f/8.0.2/share --libexecdir=/home/alanz/.stack/snapshots/x86_64-linux-tinfo6/64c75b15ef9ff77a94fea2b04f6f1c62d7431c4ecc3716689f8642d0939ec98f/8.0.2/libexec --sysconfdir=/home/alanz/.stack/snapshots/x86_64-linux-tinfo6/64c75b15ef9ff77a94fea2b04f6f1c62d7431c4ecc3716689f8642d0939ec98f/8.0.2/etc --docdir=/home/alanz/.stack/snapshots/x86_64-linux-tinfo6/64c75b15ef9ff77a94fea2b04f6f1c62d7431c4ecc3716689f8642d0939ec98f/8.0.2/doc/llvm-hs-4.0.1.0 --htmldir=/home/alanz/.stack/snapshots/x86_64-linux-tinfo6/64c75b15ef9ff77a94fea2b04f6f1c62d7431c4ecc3716689f8642d0939ec98f/8.0.2/doc/llvm-hs-4.0.1.0 --haddockdir=/home/alanz/.stack/snapshots/x86_64-linux-tinfo6/64c75b15ef9ff77a94fea2b04f6f1c62d7431c4ecc3716689f8642d0939ec98f/8.0.2/doc/llvm-hs-4.0.1.0 --dependency=Cabal=Cabal-1.24.2.0 --dependency=array=array-0.5.1.1 --dependency=base=base-4.9.1.0 --dependency=bytestring=bytestring-0.10.8.1 --dependency=containers=containers-0.5.7.1 --dependency=llvm-hs-pure=llvm-hs-pure-4.0.0.0-1MCgdEfQEIH8UDePaGXGzF --dependency=mtl=mtl-2.2.1-BLKBelFsPB3BoFeSWSOYj6 --dependency=parsec=parsec-3.1.11-4cWJ4kq7tXA22vdnbgv3it --dependency=template-haskell=template-haskell-2.11.1.0 --dependency=transformers=transformers-0.5.2.0 --dependency=transformers-compat=transformers-compat-0.5.1.4-2tm9ddmq5Qk3kF2emBuYBK --dependency=utf8-string=utf8-string-1.0.1.1-1DpjxLeTvGg7ttZZojxJR5 -f-debug -f-semigroups -fshared-llvm --exact-configuration
    Process exited with code: ExitFailure 1
    Logs have been written to: /home/alanz/mysrc/github/sdiehl/kaleidoscope/.stack-work/logs/llvm-hs-4.0.1.0.log

    [1 of 2] Compiling Main             ( /tmp/stack14812/llvm-hs-4.0.1.0/Setup.hs, /tmp/stack14812/llvm-hs-4.0.1.0/.stack-work/dist/x86_64-linux-tinfo6/Cabal-1.24.2.0/setup/Main.o )
    [2 of 2] Compiling StackSetupShim   ( /home/alanz/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs, /tmp/stack14812/llvm-hs-4.0.1.0/.stack-work/dist/x86_64-linux-tinfo6/Cabal-1.24.2.0/setup/StackSetupShim.o )
    Linking /tmp/stack14812/llvm-hs-4.0.1.0/.stack-work/dist/x86_64-linux-tinfo6/Cabal-1.24.2.0/setup/setup ...
    setup: The program 'llvm-config' version ==4.0.* is required but it could not
    be found.
Progress 1/2
codeinred commented 4 years ago

The project requires llvm as a dependency, however that is a separate issue. The problem occurs even with new projects, as mentioned above - the only difference is that it takes issue with a different version of base

Anrock commented 4 years ago

Let's stick with example project to avoid additional issues with kaleidoscope. @jantonioperez

  1. How did you install HIE?
  2. What is the value of resolver field in stack.yaml of your example project?
  3. Which hie executables you have in PATH?
lukel97 commented 4 years ago

@jantonioperez I got it to start building with stack.yaml:

resolver: lts-14.15
packages:
- '.'

and kaleidoscope.cabal

...
executable chapter2
  default-language:    Haskell2010
  main-is:             Main.hs
  other-modules: 
    Parser
    Syntax
    Lexer
  build-depends:
      base                 >= 4.7 && <5
    , haskeline            >= 0.7.1.2
    , llvm-hs              >= 8.0
    , llvm-hs-pure         >= 8.0
    , parsec               >= 3.1
    , mtl                  >= 2.1.3
    , transformers         >= 0.3.0.0 && < 0.6
  hs-source-dirs:      src/chapter2
...

Give that a try, I wasn't able to fully build it to the end though since I didn't have the llvm-8 libs installed on my machine