ucsd-progsys / liquidhaskell

Liquid Types For Haskell
BSD 3-Clause "New" or "Revised" License
1.2k stars 139 forks source link

Could not find module ‘LiquidHaskell’ #2300

Open nikivazou opened 5 months ago

nikivazou commented 5 months ago

I still get " Could not find module ‘LiquidHaskell’" (like in #2261) with ghc-9.8.2 and Cabal-3.10.2.0, is there a combination that solves this problem?

Things work if I use the language pragma instead of the compiler plagin flag.

Error: Cabal-simple_6HauvNHV_3.10.2.0_ghc-9.8.2:
'.stack/programs/x86_64-osx/ghc-9.8.2/bin/ghc-9.8.2' exited
with an error:
<command line>: Could not find module ‘LiquidHaskell’.
Use -v to see a list of the files searched for.

Error: [S-7282]
       Stack failed to execute the build plan.

       While executing the build plan, Stack encountered the error:

       [S-7011]
       While building package plonk-constraints-0.1.0.0 (scroll up to its section to see the error) using:
       .stack/setup-exe-cache/x86_64-osx/Cabal-simple_6HauvNHV_3.10.2.0_ghc-9.8.2 --verbose=1 --builddir=.stack-work/dist/x86_64-osx/ghc-9.8.2 register
       Process exited with code: ExitFailure 1
facundominguez commented 5 months ago

Hello! IIUC the problem, this is a bug in Cabal the library. We cannot do much other than working around it until the fix is released. And the work around is sticking to compiler pragmas.

Message ID: @.***>

nikivazou commented 5 months ago

Hmmm, ok! The cabal issue also is closed so I thought that they fixed it there!

facundominguez commented 5 months ago

Indeed, the cabal issue seems to have been addressed. However, it remains now to check that it is included on a release of Cabal and that this version of Cabal is used in the tooling that each of us has installed.

The minimum version of Cabal that includes the patch is 3.10.3.0 (from looking at the git history of Cabal).

$ git log Cabal-v3.10.3.0 | grep "Revert #3639"
    Revert #3639 (Don't pass -package-db and -package flags to --abi-hash) (backport #9384)
    Revert #3639 (Don't pass -package-db and -package flags to --abi-hash) (#9384)
    * Revert #3639 (Don't pass -package-db and -package flags to --abi-hash)
nikivazou commented 5 months ago

I am still stuck with this.... After specifying Cabal == 3.10.3.0 in various places (https://github.com/ucsd-progsys/liquidhaskell/commit/8ed7ff9e94f3ca7559c2eef1095b31cc7aabb202) I still get the below error:

prover-ple-lib    > Error: Cabal-simple_6HauvNHV_3.10.2.0_ghc-9.8.2:
prover-ple-lib    > '/Users/niki.vazou/.stack/programs/x86_64-osx/ghc-9.8.2/bin/ghc-9.8.2' exited
prover-ple-lib    > with an error:
prover-ple-lib    > <command line>: Could not find module ‘LiquidHaskell’.
prover-ple-lib    > Use -v to see a list of the files searched for.
prover-ple-lib    >

I assume the first line of the error implies that it is using Cabal-3.10.2.0 which seems to still be installed

cabal list --installed
* Cabal
    Synopsis: A framework for packaging Haskell software
    Default available version: 3.12.0.0
    Installed versions: 3.10.2.0, 3.10.3.0
    Homepage: http://www.haskell.org/cabal/
    License:  BSD-3-Clause

Is there any way to remove the older cabal version?

facundominguez commented 5 months ago

build-depends controls which Cabal version is linked with your artifacts but it doesn't control which Cabal version is used to build them.

Cabal-3.10.2.0 is a boot library of ghc-9.8.2. I don't think you can uninstall it.

When build-type: Custom, the following seems to influence the cabal Choice for building:

custom-setup
  setup-depends: Cabal>=3.10.3 && <4

But I'm seeing other puzzling behavior from Cabal when doing so, so I'm not sure it is worth fighting that battle this early. :)

nikivazou commented 5 months ago

Ok, makes sense! Thanks!