haskell / cabal

Official upstream development repository for Cabal and cabal-install
https://haskell.org/cabal
Other
1.62k stars 697 forks source link

Libraries are having trouble with implicit `--enable-multi-repl` enabled (by HLS?) #9860

Open Kleidukos opened 7 months ago

Kleidukos commented 7 months ago

Sometimes HLS fails to start with the following error:

1. Failed to run ["cabal","v2-repl","--keep-temp-files","--enable-multi-repl","/home/hecate/Projects/boreal/compiler/Driver.hs","/home/hecate/Projects/boreal/compiler/Boreal/Backend/Lua.hs"] in directory "/home/hecate/Projects/boreal". Consult the logs for full command and error.
   Failed command: cabal --builddir=/home/hecate/.cache/hie-bios/dist-boreal-809f41798c33e5e4cb7671c6809e1de6 v2-repl --with-compiler /home/hecate/.cache/hie-bios/wrapper-b54f81dea4c0e6d1626911c526bc4e36 --with-hc-pkg /home/hecate/.cache/hie-bios/ghc-pkg-2f24098b977902820000739f3f71b7f5 --keep-temp-files --enable-multi-repl /home/hecate/Projects/boreal/compiler/Driver.hs /home/hecate/Projects/boreal/compiler/Boreal/Backend/Lua.hs
   Resolving dependencies...

   Warning: this is a debug build of cabal-install with assertions enabled.
   Error: [Cabal-7107]
   Could not resolve dependencies:
   [__0] trying: boreal-0.1.0.0 (user goal)
   [__1] trying: pretty-simple-4.1.2.0 (dependency of boreal)
   [__2] next goal: pretty-simple:setup.Cabal (dependency of pretty-simple)
   [__2] rejecting: pretty-simple:setup.Cabal-3.10.1.0/installed-3.10.1.0 (constraint from --enable-multi-repl requires >=3.11)
   [__2] rejecting: pretty-simple:setup.Cabal; 3.10.2.1, 3.10.2.0 (constraint from project config /home/hecate/Projects/boreal/cabal.project.freeze requires ==3.10.1.0)
   [__2] rejecting: pretty-simple:setup.Cabal-3.10.1.0 (constraint from --enable-multi-repl requires >=3.11)
   [__2] rejecting: pretty-simple:setup.Cabal; 3.8.1.0, 3.6.3.0, 3.6.2.0, 3.6.1.0, 3.6.0.0, 3.4.1.0, 3.4.0.0, 3.2.1.0, 3.2.0.0, 3.0.2.0, 3.0.1.0, 3.0.0.0, 2.4.1.0, 2.4.0.1, 2.4.0.0, 2.2.0.1, 2.2.0.0, 2.0.1.1, 2.0.1.0, 2.0.0.2, 1.24.2.0, 1.24.0.0, 1.22.8.0, 1.22.7.0, 1.22.6.0, 1.22.5.0, 1.22.4.0, 1.22.3.0, 1.22.2.0, 1.22.1.1, 1.22.1.0, 1.22.0.0, 1.20.0.4, 1.20.0.3, 1.20.0.2, 1.20.0.1, 1.20.0.0, 1.18.1.7, 1.18.1.6, 1.18.1.5, 1.18.1.4, 1.18.1.3, 1.18.1.2, 1.18.1.1, 1.18.1, 1.18.0, 1.16.0.3, 1.16.0.2, 1.16.0.1, 1.16.0, 1.14.0, 1.12.0, 1.10.2.0, 1.10.1.0, 1.10.0.0, 1.8.0.6, 1.8.0.4, 1.8.0.2, 1.6.0.3, 1.6.0.2, 1.6.0.1, 1.4.0.2, 1.4.0.1, 1.4.0.0, 1.2.4.0, 1.2.3.0, 1.2.2.0, 1.2.1, 1.1.6, 1.24.1.0 (constraint from project config /home/hecate/Projects/boreal/cabal.project.freeze requires ==3.10.1.0)
   [__2] fail (backjumping, conflict set: pretty-simple, pretty-simple:setup.Cabal)
   After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: pretty-simple:setup.Cabal, pretty-simple, boreal

   Process Environment:
   HIE_BIOS_GHC: /home/hecate/.ghcup/ghc/9.6.4/lib/ghc-9.6.4/bin/ghc-9.6.4
   HIE_BIOS_GHC_ARGS: -B/home/hecate/.ghcup/ghc/9.6.4/lib/ghc-9.6.4/lib

I use cabal-nightly, but my cabal.project.freeze contains the following constraints:

constraints: any.Cabal ==3.10.1.0,
             any.Cabal-syntax ==3.10.1.0,

I'm terribly unsure about what to do. Should I disable multi-repl explicitly in my global cabal config?

fendor commented 7 months ago

Should I disable multi-repl explicitly in my global cabal config?

If I am not mistaken, that wouldn't work. hie-bios will always use the mutli-repl feature when the cabal-install version allows it (>= 3.11).

Changing the freeze file sounds sensible to me in these situations.

Maybe we want to be able to toggle multi-repl usage in HLS?

Kleidukos commented 7 months ago

Changing the freeze file sounds sensible to me in these situations.

Okay but it's a major bump from 3.10, stuff is going to break. I can try it as a hack but I don't think this is a valid workaround.

fendor commented 7 months ago

Kind of related https://github.com/haskell/haskell-language-server/issues/3738#issuecomment-1671172848

michaelpj commented 7 months ago

I thought hie-bios had a config option for multi-repl? Which presumably should allow setting it to false?

michaelpj commented 6 months ago

There will be a HLS config option for this in the next release. I don't know if there's an actual cabal issue here?