cabal
cabal copied to clipboard
Assertion failure at Distribution/Client/ProjectPlanning.hs:242:5 with --enable-documentation
Repro:
≻ rm -rf propellor-5.7.0/
≻ cabal get propellor
Unpacking to propellor-5.7.0/
≻ cd propellor-5.7.0/
≻ cabal build --enable-documentation
Resolving dependencies...
Build profile: -w ghc-8.6.4 -O1
In order, the following will be built (use -v for more details):
Assertion failed
CallStack (from HasCallStack):
assert, called at ./Distribution/Client/ProjectPlanning.hs:242:5 in main:Distribution.Client.ProjectPlanning
This is the problematic assertion:
https://github.com/haskell/cabal/blob/4061bfa2bff42b26c8240d19552dafa2e8252f75/cabal-install/Distribution/Client/ProjectPlanning.hs#L238-L244
I can reproduce this and with tracing at the point of the assertion I see the build style is BuildAndInstall.
> cabal get propellor-5.7.0
> cd propellor-5.7.0/
> cabal v2-build all --enable-documentation
Resolving dependencies...
Build profile: -w ghc-8.2.2 -O1
In order, the following will be built (use -v for more details):
BuildAndInstall
- Only-0.1 (lib) (requires build)
BuildAndInstall
- base-compat-0.9.3 (lib) (requires build)
BuildAndInstall
- base-orphans-0.7 (lib) (requires build)
BuildAndInstall
- abstract-par-0.3.3 (lib) (requires build)
BuildAndInstall
- cabal-doctest-1.0.8 (lib) (requires build)
BuildAndInstall
- clock-0.7.2 (lib) (requires build)
BuildAndInstall
- call-stack-0.1.0 (lib) (requires build)
BuildAndInstall
- colour-2.3.4 (lib) (requires build)
BuildAndInstall
- cmdargs-0.10.20 (lib) (requires build)
BuildAndInstall
- cereal-0.5.7.0 (lib) (requires build)
BuildAndInstall
- dlist-0.8.0.4 (lib) (requires build)
BuildAndInstall
- data-default-class-0.1.2.0 (lib:data-default-class) (requires build)
BuildAndInstall
- fgl-5.6.0.0 (lib) (requires build)
BuildAndInstall
- fail-4.9.0.0 (lib) (requires build)
BuildAndInstall
- fixed-0.2.1.1 (lib) (requires build)
BuildAndInstall
- ghc-paths-0.1.0.9 (lib:ghc-paths) (requires build)
BuildAndInstall
- ghc-tcplugins-extra-0.2.5 (lib) (requires build)
Assertion failed
CallStack (from HasCallStack):
assert, called at ./Distribution/Client/ProjectPlanning.hs:244:5 in
main:Distribution.Client.ProjectPlanning
Just ran into this issue trying to build documentation for dependencies of an executable, with a command of the form
cabal haddock exe:MyExe --enable-documentation
For the time being I re-compiled cabal-install without the assertion and the documentation builds as expected.
Me too. With https://github.com/agda/agda/ commit 834b75908632e1633c0fe9b0ab1cd39195b51aa3:
$ cabal build --enable-tests --enable-documentation
Resolving dependencies...
Build profile: -w ghc-8.10.3 -O1
In order, the following will be built (use -v for more details):
- ieee754-0.8.0 (lib:ieee754) (requires build)
- STMonadTrans-0.4.5 (lib) (requires build)
- blaze-builder-0.4.2.1 (lib) (requires build)
- base-compat-0.11.2 (lib) (requires build)
- base-orphans-0.8.4 (lib) (requires build)
- clock-0.8.2 (lib) (requires build)
- call-stack-0.3.0 (lib) (requires build)
- colour-2.3.5 (lib) (requires build)
- data-default-class-0.1.2.0 (lib:data-default-class) (requires build)
- data-hash-0.2.0.1 (lib) (requires build)
- fail-4.9.0.0 (lib) (requires build)
Assertion failed
CallStack (from HasCallStack):
assert, called at src/Distribution/Client/ProjectPlanning.hs:237:5 in main:Distribution.Client.ProjectPlanning
$ cabal --version
cabal-install version 3.5.0.0
compiled using version 3.5.0.0 of the Cabal library
(Recent development version of cabal-install.)
Me too, current LambdaHack, almost current cabal from master branch. This cabal.project.local
package *
documentation: True
repository head.hackage.ghc.haskell.org
url: https://ghc.gitlab.haskell.org/head.hackage/
secure: True
key-threshold: 3
root-keys:
7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d
26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329
f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89
causes
~/r/LambdaHack$ cabal build -w /home/mikolaj/r/ghc/_build/stage1/bin/ghc --allow-newer
Build profile: -w ghc-9.3.20220316 -O1
In order, the following will be built (use -v for more details):
- StateVar-1.2.2 (lib) (requires build)
- base-compat-0.12.1 (lib) (requires build)
- base-orphans-0.8.6 (lib) (requires build)
- colour-2.3.6 (lib) (requires build)
- file-embed-0.0.15.0 (lib) (requires build)
Assertion failed
CallStack (from HasCallStack):
assert, called at src/Distribution/Client/ProjectPlanning.hs:243:5 in cabal-install-3.7.0.0-inplace:Distribution.Client.ProjectPlanning
This is happening to many people in many tickets over the years, so I'm bumping priority.
Another instance:
- #8313
As of cabal-install-3.8.1.0, I'm getting a proper error message for the original reproducer:
$ cabal build --enable-documentation -w ghc-8.6
Resolving dependencies...
Build profile: -w ghc-8.6.5 -O1
In order, the following will be built (use -v for more details):
- propellor-5.7.0 (lib) (first run)
- propellor-5.7.0 (exe:propellor-config) (first run)
- propellor-5.7.0 (exe:propellor) (first run)
Configuring library for propellor-5.7.0..
Error: cabal-3.8.1.0: Duplicate modules in library: Utility.Scheduled
Error: cabal: Failed to build propellor-5.7.0 (which is required by
exe:propellor-config from propellor-5.7.0 and exe:propellor from
propellor-5.7.0). The failure occurred during the configure step.
If I remove the duplicate module from the exposed-modules section, I get a clean build for the same command.
EDIT: propellor issue: https://propellor.branchable.com/todo/Deduplicate_exposed-modules/
Great news! Should this be closed?
Should this be closed?
I wouldn't mind. It might be interesting to check whether the instances reported in https://github.com/haskell/cabal/issues/6006#issuecomment-774214724 and https://github.com/haskell/cabal/issues/6006#issuecomment-1074982814 are also fixed though.
Right... I doubt all of them had the same issue with duplicate modules. And also, wasn't it only appearing when you use cabal built with assertions on, so not releases?
On the other note, I'm failing to repro Andreas' example in https://github.com/haskell/cabal/issues/6006#issuecomment-774214724 with the current master.
On the other note, I'm failing to repro Andreas' example in #6006 (comment) with the current
master.
Still reproduces on my machine.
And also, wasn't it only appearing when you use cabal built with assertions on, so not releases?
I just tried the original reproducer (propellor-5.7.0) with a version of cabal built from this repo at the cabal-install-v3.8.1.0 tag, so assertions should be enabled (I think). I'm still getting the Duplicate modules error with this version of cabal.
@sjakobi: if you didn't build with cabal.project.release (as README suggests), but with the default cabal.project then the assertions should be enabled. Do I understand the Duplicate modules error is fine? It's the assertion failure crash that is bad?
Do I understand the
Duplicate moduleserror is fine? It's the assertion failure crash that is bad?
Yes, the Duplicate modules error is good UX IMHO. The assertion failure seemed to indicate a internal logic bug in cabal-install which might be worth investigating.
As discussed on IRC today, this assert is very harmful to testing developer builds, so that it's worth disabling for the time being. Hopefully a brave soul will once find out why it's failing. See https://github.com/haskell/cabal/pull/8821.
I think this assertion should be fixed because it means something is inconsistent between what the hash inputs were when the elabComponentId was calculated and the inputs computed from the ElaboratedConfigurePackage.. these should definitely be the same as each other.
I think this could lead to things going quite wrong (but I am not sure how) The way to investigate is to print out the packageHashInputs to see where the difference is and then work out why it's different for the two cases.