ucsd-progsys / liquidhaskell

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

cabal install => Error: cabal: Driver_stack.hsDriver_cabal.hs doesn't exist #2258

Closed jwaldmann closed 6 months ago

jwaldmann commented 9 months ago

I wanted to build from source. I did

git clone --recurse-submodules https://github.com/ucsd-progsys/liquidhaskell
cd liquidhaskell/
cabal install

and I get

Wrote tarball sdist to
...
Error: cabal: Driver_stack.hsDriver_cabal.hs doesn't exist

this is with

$ git log |head -1
commit 3ca414c77690a55ba9c7d4acf3b4b91ceaab2762
$ cabal --version
cabal-install version 3.10.2.1
compiled using version 3.10.1.0 of the Cabal library 
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.6.3
facundominguez commented 9 months ago

Thanks for the report @jwaldmann.

It looks like a bug in cabal. This at least makes it work for me:

diff --git a/tests/tests.cabal b/tests/tests.cabal
index f6c1acd8a..280ee7a92 100644
--- a/tests/tests.cabal
+++ b/tests/tests.cabal
@@ -25,10 +25,7 @@ flag measure-timings
                than once, and the second run discards the timings of the first.

 executable test-driver
-    if flag(stack)
-      main-is:        Driver_stack.hs
-    else
-      main-is:        Driver_cabal.hs
+    main-is:        Driver_cabal.hs

     build-depends:    base < 5
                     , shelly

We don't use cabal install ourselves to install from the working copy, and I'm discovering that cabal-install insists in making tarballs for every package even if one wants to install only one of them.

As a workaround, you could remove failing packages from ./cabal.project. I just tried it and ./tests and ./scripts/plot-performance are the only packages with errors.

I just fixed ./scripts/plot-performance in 6d04eb4.

jwaldmann commented 9 months ago

Yes, "remove failing packages from cabal.project" does work.

I then arrive at

Installing library in /home/waldmann/.cabal/store/ghc-9.6.3/incoming/new-78487/home/waldmann/.cabal/store/ghc-9.6.3/liquidhaskell-0.9.4.7.0-c9731030f7c476ad2cc653dcb0da2f2c218b6420ed55088e534841af45a76acb/lib
Error: setup: '/opt/ghc/latest/bin/ghc-9.6.3' exited with an error:
<command line>: Could not find module ‘LiquidHaskellBoot’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.

Error: cabal: Failed to build liquidhaskell-0.9.4.7.0 (which is required by
exe:liquidhaskell from liquid-platform-0.9.2.8). See the build log above for
details.

Similar error with stack install. But I should make a separate issue for that.

jwaldmann commented 9 months ago

It looks like a bug in cabal.

I found by trial-and-error that else must be indented ..

diff --git a/tests/tests.cabal b/tests/tests.cabal
index f6c1acd8a..cc47ff570 100644
--- a/tests/tests.cabal
+++ b/tests/tests.cabal
@@ -27,7 +27,7 @@ flag measure-timings
 executable test-driver
     if flag(stack)
       main-is:        Driver_stack.hs
-    else
+     else
       main-is:        Driver_cabal.hs

     build-depends:    base < 5

but the documentation does not say so? https://cabal.readthedocs.io/en/stable/cabal-package.html#conditional-blocks

facundominguez commented 9 months ago

That's an interesting finding. I'm trying it in #2260 ... and it doesn't work.