haskell-language-server icon indicating copy to clipboard operation
haskell-language-server copied to clipboard

Switching GHC with 2.11.0.0 on Windows causes failure

Open dfordivam opened this issue 8 months ago • 5 comments

This seems to be related to the CI failure here https://github.com/haskell/ghcup-metadata/issues/315

I tested the same steps with 2.10.0.0 and did not hit this issue.

Your environment

Which OS do you use? windows

Which version of GHC do you use and how did you install it?

cabal --version
cabal-install version 3.14.2.0

How is your project built (alternative: link to the project)?

Which LSP client (editor/plugin) do you use?

Which version of HLS do you use and how did you install it?

Have you configured HLS in any way (especially: a hie.yaml file)?

Steps to reproduce

ghcup set 9.10.2
haskell-language-server-wrapper-2.11.0.0.exe typecheck .\src\Data\Text.hs

ghcup set 9.6.7
haskell-language-server-wrapper-2.11.0.0.exe typecheck .\src\Data\Text.hs

Expected behaviour

Actual behaviour

Error:

Hidden:   no
Range:    1:1-2:1
Source:   compiler
Severity: DiagnosticSeverity_Error
Code:     <none>
Message:
  (GhcSession,NormalizedFilePath "C:\\Users\\dford\\text-2.1.2\\src\\Data\\Text.hs")cannot satisfy       
  -package-id array-0.5.8.0-2b9d
  (use -v for more information)
Files that failed:
 * C:\Users\dford\text-2.1.2\src\Data\Text.hs

Debug information

dfordivam avatar Jun 16 '25 09:06 dfordivam

I could not reproduce this with HLS 2.11.0.0 and cabal 3.12.1.0. So seems to be a problem only with HLS 2.11.0.0 and cabal 3.14.2.0. (The 2.10.0.0 and 3.14.2.0 worked fine though)

dfordivam avatar Jun 16 '25 10:06 dfordivam

In HLS 2.11.0.0 we changed how hie-bios invokes cabal, might be related.

In particular, we call cabal path and use the obtained ghc path in the wrapper

fendor avatar Jun 16 '25 11:06 fendor

HLS 2.11.0.0, GHC 9.12.2, Cabal 3.16.0.0 on macOS produces an error as well:

$ haskell-language-server-wrapper-2.11.0.0 typecheck ./app/Main.hs

Hidden:   no
Range:    1:1-2:1
Source:   compiler
Severity: DiagnosticSeverity_Error
Code:     <none>
Message:
  (GhcSession,NormalizedFilePath
  "/example/app/Main.hs")cannot
  satisfy -package example-0.1.0.0
  (use -v for more information)
Files that failed:
 * /example/app/Main.hs

Completed (0 files worked, 1 file failed)

alienvspredator avatar Jul 26 '25 21:07 alienvspredator

The issue is reproducible with HLS 2.10.0.0 and GHC 9.10.1 on macOS as well

Environment:

  • haskell-language-server version: 2.11.0.0 (GHC: 9.12.2) from ghcup
  • haskell-language-server version: 2.10.0.0 (GHC: 9.10.1) compiled from source

Running

$ haskell-language-server-wrapper-2.11.0.0 typecheck ./App/Main.hs

or

$ haskell-language-server-9.10.1\~2.10.0.0 typecheck ./App/Main.hs

Produces the following logs:

Click to expand
$ haskell-language-server-wrapper-2.11.0.0 typecheck ./app/Main.hs
No 'hie.yaml' found. Try to discover the project type!
Run entered for haskell-language-server-wrapper(haskell-language-server-wrapper-2.11.0.0) Version 2.11.0.0 aarch64 ghc-9.12.2
Current directory: /example
Operating system: darwin
Arguments: ["typecheck","./app/Main.hs"]
Cradle directory: /example
Cradle type: Stack

Tool versions found on the $PATH
cabal:          3.16.0.0
stack:          3.7.1
ghc:            9.12.2


Consulting the cradle to get project GHC version...
2025-07-26T22:06:14.274431Z | Debug | stack --stack-yaml /example/stack.yaml setup --silent
2025-07-26T22:06:14.534687Z | Debug | stack --stack-yaml /example/stack.yaml exec ghc -- --numeric-version
Project GHC version: 9.12.2
haskell-language-server exe candidates: ["haskell-language-server-9.12.2","haskell-language-server"]
Launching haskell-language-server exe at:/.ghcup/bin/haskell-language-server-9.12.2
2025-07-26T22:06:15.191972Z | Debug | stack --stack-yaml /example/stack.yaml setup --silent
2025-07-26T22:06:15.807702Z | Debug | stack --stack-yaml /example/stack.yaml exec ghc -- -v0 -package-env=- -ignore-dot-ghci -e Control.Monad.join (Control.Monad.fmap System.IO.putStr System.Environment.getExecutablePath)
2025-07-26T22:06:16.459392Z | Debug | stack --stack-yaml /example/stack.yaml setup --silent
2025-07-26T22:06:16.721059Z | Debug | stack --stack-yaml /example/stack.yaml exec ghc -- --print-libdir
2025-07-26T22:06:16.855640Z | Info | haskell-language-server version: 2.11.0.0 (GHC: 9.12.2) (PATH: /.ghcup/bin/haskell-language-server-9.12.2~2.11.0.0)
2025-07-26T22:06:16.856072Z | Info | Directory: /example
2025-07-26T22:06:16.856265Z | Info | Logging heap statistics every 60.00s
 ghcide setup tester in /example.
Report bugs at https:/github.com/haskell/haskell-language-server/issues

Step 1/4: Finding files to test in /example
Found 1 files

Step 2/4: Looking for hie.yaml files that control setup
Found 1 cradle
  ()

Step 3/4: Initializing the IDE

Step 4/4: Type checking the files
2025-07-26T22:06:16.860494Z | Info | Cradle path: app/Main.hs
2025-07-26T22:06:16.860542Z | Warning | No [cradle](https:/github.com/mpickering/hie-bios#hie-bios) found for app/Main.hs.
Proceeding with [implicit cradle](https:/hackage.haskell.org/package/implicit-hie).
You should ignore this message, unless you see a 'Multi Cradle: No prefixes matched' error.
2025-07-26T22:06:16.862220Z | Info | invoking build tool to determine build flags (this may take some time depending on the cache)
2025-07-26T22:06:16.862524Z | Info | stack --stack-yaml /example/stack.yaml repl --no-nix-pure --with-ghc /.cache/hie-bios/wrapper-b54f81dea4c0e6d1626911c526bc4e36 example:exe:example-exe
  Environment Variables
    HIE_BIOS_OUTPUT: /private/var/folders/wk/k07p8c4x4sn8sh5ptcsyp57r0000gn/T/HIE_BIOS_OUTPUT14477-0
2025-07-26T22:06:17.701107Z | Info | stack --stack-yaml /example/stack.yaml path --ghc-package-path
  Environment Variables
    HIE_BIOS_OUTPUT: /private/var/folders/wk/k07p8c4x4sn8sh5ptcsyp57r0000gn/T/HIE_BIOS_OUTPUT14477-1
2025-07-26T22:06:19.753717Z | Info | Interface files cache directory: /.cache/ghcide/main-f42b4a7f21c4da58f311532bd976ad2fd35bfa5e-f42b4a7f21c4da58f311532bd976ad2fd35bfa5e
2025-07-26T22:06:19.755370Z | Info | Making new HscEnv. In-place unit ids: [ main-f42b4a7f21c4da58f311532bd976ad2fd35bfa5e ]
2025-07-26T22:06:19.757299Z | Info | updateFileDiagnostics published different from new diagnostics - file diagnostics: File:     /example/app/Main.hs
Hidden:   no
Range:    1:1-2:1
Source:   compiler
Severity: DiagnosticSeverity_Error
Code:     <none>
Message:
  (GhcSession,NormalizedFilePath
  "/example/app/Main.hs")cannot
  satisfy -package example-0.1.0.0
  (use -v for more information)
Files that failed:
 * /example/app/Main.hs

Completed (0 files worked, 1 file failed)

alienvspredator avatar Jul 27 '25 00:07 alienvspredator

@alienvspredator Hi, thanks for the data point!

You are using stack for building your project, and what you are encountering looks like the bug https://github.com/commercialhaskell/stack/issues/5380, so running stack build before launching HLS should fix this issue.

I think your issue is separated to the one reported by @dfordivam

fendor avatar Jul 27 '25 13:07 fendor