Repository navigation
Description
Describe the bug
Alternating cabal v2-buildand cabal v2-install over cabal-helper-1.0.0.0 or a package that depends on it (in my case haskell-ide-engine) with a fresh cabal store throws a build error cause the dependency cabal-plan is added twice when compiling.
It worths to note that cabal-helperis using a private named lib: https://github.com/DanielG/cabal-helper/blob/master/cabal-helper.cabal#L116
The error is:
Preprocessing library for cabal-helper-1.0.0.0..
Building library for cabal-helper-1.0.0.0..
[1 of 3] Compiling Distribution.Helper ( lib\Distribution\Helper.hs, dist\build\Distribution\Helper.o )
lib\Distribution\Helper.hs:591:68: error:
• Couldn't match expected type ‘cabal-plan-0.6.2.0:Cabal.Plan.PlanJson’
with actual type ‘PlanJson’
NB: ‘PlanJson’
is defined in ‘Cabal.Plan’ in package ‘cabal-plan-0.6.2.0’
‘cabal-plan-0.6.2.0:Cabal.Plan.PlanJson’
is defined in ‘Cabal.Plan’ in package ‘cabal-plan-0.6.2.0’
• In the first argument of ‘CabalInstall.planPackages’, namely
‘plan’
In the second argument of ‘(<$>)’, namely
‘CabalInstall.planPackages plan’
In a stmt of a 'do' block:
Just pkgs <- NonEmpty.nonEmpty <$> CabalInstall.planPackages plan
|
591 | Just pkgs <- NonEmpty.nonEmpty <$> CabalInstall.planPackages plan
| ^^^^
To Reproduce
I can't reproduce it locally in a consistent way, but i've triggered it deleting the cabal store and make cabal v2-build and cabal v2-install.
@fendor has experienced the issue in linux and me in windows
However it is reproduced consistently in azure ci for windows (not linux), see for example: https://dev.azure.com/jneira/haskell-ide-engine/_build/results?buildId=502&view=results
Steps to reproduce the behavior:
- removing the existent cabal store
- run
cabal v2-buildin thehaskell-ide-enginerepo - run
cabal v2-install
The azure ci bash scripts of the build: https://github.com/jneira/haskell-ide-engine/blob/azure-cabal/.azure/windows-cabal.yml
Expected behavior
The build should finish correctly
System information
- Several windows systems and linux ones
cabal-3.0.0.0,ghc-8.6.5andghc-8.4.4
Additional context
You can workaround the issue removing the cabal-plan-* dirs inside the cabal store and running @phadej script to fix the store (or removing the entire store)
Related issues: #6412 and #5782
Activity
phadej commentedon Jan 17, 2020
I guess this is the same problem as #6211
Without consistent reproducer, I doubt it can be fixed easily. Note that #6211 uses internal library as well.
phadej commentedon Jan 17, 2020
I'm closing this as duplicate (I'm pretty sure there is the same root cause).
phadej commentedon Jan 17, 2020
I'm unable to reproduce #6211 myself anymore using `cabal-install-3.0.1.0 from hvr's ppa, which is https://github.com/haskell/cabal/releases/tag/cabal-install-v3.0.1.0-rc4, but it doesn't mean issue is fixed.
Edit: I recall changing something in
installcode, maybe fixing #6410, fixed this as well.hasufell commentedon Jan 21, 2020
This sounds like a major bug to me if I cannot trust the build-store to be consistent. I just hit this as well in hie. I will try to create a docker container with my state of the .cabal dir.
Merge pull request #1595 from jneira/azure
Turn private library into common stanza
Turn private library into common stanza
Turn private library into common stanza
Turn private library into common stanza
Mikolaj commentedon May 6, 2021
@hasufell: hi! We guess (#5782 (comment)) this issue is fixed in new stable cabals --- could you perhaps try to reproduce locally your case with new cabal and confirm?
hasufell commentedon May 6, 2021
The bug was never easy to reproduce. I haven't hit it in a long time though. Whether that means it's fixed: I don't know.
Mikolaj commentedon May 7, 2021
@hasufell: got it; thank you