Skip to content

Error building/installing cabal-helper-1.0.0.0 #6483

Closed

Description

@jneira

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

Activity

  1. phadej commented on Jan 17, 2020

    @phadej
    Collaborator

    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.

  2. phadej commented on Jan 17, 2020

    @phadej
    Collaborator

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

  3. phadej commented on Jan 17, 2020

    @phadej
    Collaborator

    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.

  4. hasufell commented on Jan 21, 2020

    @hasufell
    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.

  5. added a commit that references this issue on Jan 24, 2020
  6. Mikolaj commented on May 6, 2021

    @Mikolaj
    Member

    @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?

  7. hasufell commented on May 6, 2021

    @hasufell
    Member

    @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.

  8. Mikolaj commented on May 7, 2021

    @Mikolaj
    Member

    @hasufell: got it; thank you

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions