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

Error building/installing cabal-helper-1.0.0.0 #6483

Closed
jneira opened this issue Jan 17, 2020 · 7 comments
Closed

Error building/installing cabal-helper-1.0.0.0 #6483

jneira opened this issue Jan 17, 2020 · 7 comments

Comments

@jneira
Copy link
Member

jneira commented Jan 17, 2020

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-build in the haskell-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.5 and ghc-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

@phadej
Copy link
Collaborator

phadej commented 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
Copy link
Collaborator

phadej commented Jan 17, 2020

I'm closing this as duplicate (I'm pretty sure there is the same root cause).

@phadej phadej closed this as completed Jan 17, 2020
@phadej
Copy link
Collaborator

phadej commented 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 install code, maybe fixing #6410, fixed this as well.

@hasufell
Copy link
Member

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.

jneira added a commit to haskell/haskell-ide-engine that referenced this issue Jan 24, 2020
* Separate test suites: 
  * To handle specific conditions, make log inspection easier and run them with cabal without `-j1`
  * unit-test
  * dipatcher-test, plugin-dispatcher-test, wrapper-test
  * functional-test
* Add ghc-8.8.1 to linux and macos jobs (#1593)
* Add cache to installhs jobs
* Install ghc's in windows+stack jobs in drive `D:` to avoid errors about no space in `C:`
* Change stack_root to `D:` in windows+stack for the same reason
* Add new job windows+cabal for ghc 8.6.5 and ghc-8.4.4
  * Using chocolatey to download cabal and ghc
  * Separating the `store-dir` of builds and install to avoid haskell/cabal#6483
* Enable installhs job for windows+cabal
* Other minor fixes
fendor added a commit to fendor/cabal-helper that referenced this issue Feb 8, 2020
Private libraries have a bunch of bugs in cabal currently:
* haskell/cabal#6211
* haskell/cabal#6483

and devs of haskell-ide-engine are encountering this bug frequently.
To mitigate this issue, remove usage of private libraries and use
a common stanza to have the same re-use as before.

This change can be undone when the mentioned issues have been resolved.
fendor added a commit to fendor/cabal-helper that referenced this issue Feb 8, 2020
Private libraries have a bunch of bugs in cabal currently:
* haskell/cabal#6211
* haskell/cabal#6483

and devs of haskell-ide-engine are encountering this bug frequently.
To mitigate this issue, remove usage of private libraries and use
a common stanza to have the same re-use as before.

This change can be undone when the mentioned issues have been resolved.
DanielG pushed a commit to DanielG/cabal-helper that referenced this issue Feb 8, 2020
Private libraries have a bunch of bugs in cabal currently:
* haskell/cabal#6211
* haskell/cabal#6483

and devs of haskell-ide-engine are encountering this bug frequently.
To mitigate this issue, remove usage of private libraries and use
a common stanza to have the same re-use as before.

This change can be undone when the mentioned issues have been resolved.
DanielG pushed a commit to DanielG/cabal-helper that referenced this issue Feb 8, 2020
Private libraries have a bunch of bugs in cabal currently:
* haskell/cabal#6211
* haskell/cabal#6483

and devs of haskell-ide-engine are encountering this bug frequently.
To mitigate this issue, remove usage of private libraries and use
a common stanza to have the same re-use as before.

This change can be undone when the mentioned issues have been resolved.
@Mikolaj
Copy link
Member

Mikolaj commented 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
Copy link
Member

hasufell commented 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?

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
Copy link
Member

Mikolaj commented May 7, 2021

@hasufell: got it; thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants