Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion failed after changing the version: field in the middle of a cabal build #10812

Open
andreasabel opened this issue Mar 3, 2025 · 0 comments

Comments

@andreasabel
Copy link
Member

Maybe cabal should cache the contents of build configuration files (.cabal files, cabal.project etc) during a build so that changes to these files don't get cabal into inconsistent states.

The scenario:

  1. clone https://github.com/agda/agda, checkout tag v2.7.0.1, and start cabal build
  2. once GHC starts compiling the 400+ modules of the Agda library, while the build is still running (takes quite a while), change the version in Agda.cabal to e.g. 2.7.0.
  3. then after the build is finished, restart cabal build
  4. observe the Assertion failed; cabal is in an inconsistent state

Here is a run (with version 2.8.0.1 -> 2.8.0)

$ cabal build
...
[437 of 437] Compiling Agda.Main        ( src/full/Agda/Main.hs, /Users/abela/agda/dist-newstyle/build/aarch64-osx/ghc-9.10.1/Agda-2.8.0.1/build/Agda/Main.o, /Users/abela/agda/dist-newstyle/build/aarch64-osx/ghc-9.10.1/Agda-2.8.0.1/build/Agda/Main.dyn_o )
...
./Agda.cabal has been changed. Re-configuring with most recently used options.
If this fails, please run configure manually.
Configuring library for Agda-2.8.0...
Configuring executable 'agda' for Agda-2.8.0...
Preprocessing executable 'agda' for Agda-2.8.0...
Building executable 'agda' for Agda-2.8.0...
[1 of 1] Compiling Main             ( src/main/Main.hs, /Users/abela/agda/dist-newstyle/build/aarch64-osx/ghc-9.10.1/Agda-2.8.0.1/x/agda/build/agda/agda-tmp/Main.o )
[2 of 2] Linking /Users/abela/agda/dist-newstyle/build/aarch64-osx/ghc-9.10.1/Agda-2.8.0.1/x/agda/build/agda/agda
...
$  cabal build                                                                                      ✔ │ 5m 19s │ 18:05:41 
Resolving dependencies...
Build profile: -w ghc-9.10.1 -O1
In order, the following will be built (use -v for more details):
 - Agda-2.8.0.1 (lib) (configuration changed)
 - Agda-2.8.0.1 (exe:agda-mode) (configuration changed)
 - Agda-2.8.0.1 (exe:agda) (configuration changed)
Configuring executable 'agda-mode' for Agda-2.8.0.1...
Configuring library for Agda-2.8.0.1...
Preprocessing executable 'agda-mode' for Agda-2.8.0.1...
Building executable 'agda-mode' for Agda-2.8.0.1...
Preprocessing library for Agda-2.8.0.1...
Building library for Agda-2.8.0.1...
...
[8 of 8] Linking /Users/abela/agda/dist-newstyle/build/aarch64-osx/ghc-9.10.1/Agda-2.8.0.1/x/agda-mode/build/agda-mode/agda-mode [Objects changed]
...
[152 of 437] Compiling Agda.Setup       ( src/setup/Agda/Setup.hs, /Users/abela/agda/dist-newstyle/build/aarch64-osx/ghc-9.10.1/Agda-2.8.0.1/build/Agda/Setup.o, /Users/abela/agda/dist-newstyle/build/aarch64-osx/ghc-9.10.1/Agda-2.8.0.1/build/Agda/Setup.dyn_o ) [src/data/latex/agda.sty changed]
...
Configuring executable 'agda' for Agda-2.8.0.1...
Assertion failed
CallStack (from HasCallStack):
  assert, called at src/Distribution/Simple/PackageIndex.hs:210:30 in Cabal-3.12.1.0-inplace:Distribution.Simple.PackageIndex
  mkPackageIndex, called at src/Distribution/Simple/PackageIndex.hs:225:17 in Cabal-3.12.1.0-inplace:Distribution.Simple.PackageIndex
Error: [Cabal-7125]
Failed to build exe:agda from Agda-2.8.0.1. The failure occurred during the configure step.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant