Closed mb2a-sgn closed 2 months ago
Hi, thank you for bug report and the detailed instructions!
HLS's support for build-type: Custom
is generally speaking not great. So, I am not surprised there are a couple of sharp edges.
I can not reproduce exactly the same error, though, on the first run, I am getting:
Failed to run ["cabal","v2-repl","/home/hugin/Downloads/my-lib/test/Spec.hs"] in directory
"/home/hugin/Downloads/my-lib". Consult the logs for full command and error.
Failed command: cabal
--builddir=/home/hugin/.cache/hie-bios/dist-my-lib-52c1f96b1804b573257fc6cf0e1e0dc2 v2-repl
--with-compiler /home/hugin/.cache/hie-bios/wrapper-b54f81dea4c0e6d1626911c526bc4e36 --with-hc-pkg
/home/hugin/.cache/hie-bios/ghc-pkg-99f55999495b863a61d4f15d989eaab4
/home/hugin/Downloads/my-lib/test/Spec.hs
Build profile: -w ghc-9.6.5 -O1
In order, the following will be built (use -v for more details):
- cabal-doctest-1.0.10 (lib) (requires build)
- ghc-paths-0.1.0.12 (lib:ghc-paths) (requires build)
- doctest-0.22.4 (lib) (requires download & build)
- my-lib-0.1.1.0 (interactive) (first run)
Downloading doctest-0.22.4
Starting ghc-paths-0.1.0.12 (all, legacy fallback: build-type is Custom)
Starting cabal-doctest-1.0.10 (lib)
Downloaded doctest-0.22.4
Building cabal-doctest-1.0.10 (lib)
Installing cabal-doctest-1.0.10 (lib)
Completed cabal-doctest-1.0.10 (lib)
Building ghc-paths-0.1.0.12 (all, legacy fallback: build-type is Custom)
Installing ghc-paths-0.1.0.12 (all, legacy fallback: build-type is Custom)
Completed ghc-paths-0.1.0.12 (all, legacy fallback: build-type is Custom)
Starting doctest-0.22.4 (lib)
Building doctest-0.22.4 (lib)
Installing doctest-0.22.4 (lib)
Completed doctest-0.22.4 (lib)
[1 of 2] Compiling Main (
/home/hugin/.cache/hie-bios/dist-my-lib-52c1f96b1804b573257fc6cf0e1e0dc2/build/x86_64-linux/ghc-9.6.5/my-lib-0.1.1.0/setup/setup.hs,
/home/hugin/.cache/hie-bios/dist-my-lib-52c1f96b1804b573257fc6cf0e1e0dc2/build/x86_64-linux/ghc-9.6.5/my-lib-0.1.1.0/setup/Main.o
) [Distribution.Extra.Doctest package changed]
[2 of 2] Linking
/home/hugin/.cache/hie-bios/dist-my-lib-52c1f96b1804b573257fc6cf0e1e0dc2/build/x86_64-linux/ghc-9.6.5/my-lib-0.1.1.0/setup/setup
[Objects changed]
Configuring my-lib-0.1.1.0...
[1 of 2] Compiling Main (
/home/hugin/.cache/hie-bios/dist-my-lib-52c1f96b1804b573257fc6cf0e1e0dc2/build/x86_64-linux/ghc-9.6.5/my-lib-0.1.1.0/setup/setup.hs,
/home/hugin/.cache/hie-bios/dist-my-lib-52c1f96b1804b573257fc6cf0e1e0dc2/build/x86_64-linux/ghc-9.6.5/my-lib-0.1.1.0/setup/Main.o
) [Distribution.Extra.Doctest package changed]
[2 of 2] Linking
/home/hugin/.cache/hie-bios/dist-my-lib-52c1f96b1804b573257fc6cf0e1e0dc2/build/x86_64-linux/ghc-9.6.5/my-lib-0.1.1.0/setup/setup
[Objects changed]
Saved package config file is outdated:
• the Cabal version changed from Cabal-3.12.1.0 to Cabal-3.10.3.0
Re-run the 'configure' command.
Error: [Cabal-7125]
repl failed for my-lib-0.1.1.0.
And after I ran cabal build all --enable-testing
once, it started working altogether, and I can't get it to fail again :thinking:. However, it is really slow to load the project.
Full disclosure, I am not running the nix flake
as I didn't really need it.
Perhaps fixed on a more recent HLS version? Could you try to reproduce on a more recent GHC version that has proper multi home unit support and more recent HLS version?
Thank you for your cooperation.
Indeed, the HLS version 2.4.0 was outdated. After updating GHC to 9.4.8 and HLS to 2.9.00, the problem is not reproduced in my environment. my-lib.tar.gz
The problem seems to be probabilistic so it's not easy, but I think we can close this issue until the problem occurs again.
Thanks for checking!
Ok, then let's close this and feel free to reopen or open a new issue if you run into any problems :)
Your environment
I prepared a small project to reproduce the issue. (Nix Flakes are required)
my-lib.tar.gz
Which OS do you use? NixOS on WSL2
Which version of GHC do you use and how did you install it? GHC 9.2.8 from Nix Flakes
Which LSP client (editor/plugin) do you use? VS Code + Haskell plugin Which version of HLS do you use and how did you install it? 2.4.0.0 from Nix Flakes
Have you configured HLS in any way (especially: a
hie.yaml
file)? No.Steps to reproduce
Prerequisites: Nix Flakes
From CLI: (reproduce the issue probabilistically)
nix develop
haskell-language-server-wrapper src/Lib.hs test/Spec.hs
From VS Code:
nix develop
code .
test/Spec.hs
and wait for the language server to start. At this point, there should be no errors.src/Lib.hs
.Expected behaviour
No compile errors are reported
Actual behaviour
Could not load module 'Lib'
intest/Spec.hs
.The tricky part is that no errors occur when only one of
Lib.hs
orSpec.hs
was opened, but onceLib.hs
is opened, errors start appearing inSpec.hs
.Debug information
The following is logs when
haskell-language-server-wrapper src/Lib.hs test/Spec.hs
failed. (Here,haskell-language-server-wrapper
is configured with Nix to use--debug --logfile hls.log
. This setting exists because arguments cannot be passed to the Haskell language server from VS Code.)The following is VS Code case.
hls.log