Skip to content

Unable to build with backpack modules from unpacked-containers package #6835

Closed
@harendra-kumar

Description

@harendra-kumar

Describe the bug

I have the following cabal file:

cabal-version:       2.0
name:                unpacked-example
version:             0.1.0.0
build-type:          Simple

library example
  default-language: Haskell2010
  hs-source-dirs: example
  exposed-modules: Int
  build-depends: base

executable unpacked-set-example
  default-language: Haskell2010
  main-is: example/Main.hs
  build-depends: base, unpacked-containers, example
  mixins: unpacked-containers (Set as Int.Set) requires (Key as Int)

And the following source files:

$ cat example/Int.hs 
module Int where

type Key = Int
$ cat example/Main.hs 
module Main where

import Int.Set

ten :: Set
ten = fromList [1..10]

main :: IO ()
main = print ten

I can't build it and cannot figure out what is wrong. Here is the cabal build message:

$ cabal v2-build
Build profile: -w ghc-8.8.3 -O1
In order, the following will be built (use -v for more details):
 - unpacked-containers-0 (lib with Key=unpacked-example-0.1.0.0-inplace-example:Int) (requires build)
 - unpacked-example-0.1.0.0 (exe:unpacked-set-example) (first run)
Starting     unpacked-containers-0 (lib)

Failed to build unpacked-containers-0. The failure occurred during the
configure step.
Build log (
/Users/harendra/.cabal/logs/ghc-8.8.3/npckd-cntnrs-0-8f491d38+B2PfsuvwtufFrJw0XqUoXM.log
):
Configuring library instantiated with
  Key = unpacked-example-0.1.0.0-inplace-example:Int
for unpacked-containers-0..
Warning: The package has an extraneous version range for a dependency on an
internal library: unpacked-containers -any && ==0. This version range includes
the current package but isn't needed as the current package's library will
always be used.
Error:
    The following packages are broken because other packages they depend on are missing. These broken packages must be rebuilt before they can be used.
planned package unpacked-containers-0 is broken due to missing package unpacked-example-0.1.0.0-inplace-example

cabal: Failed to build unpacked-containers-0 (which is required by
exe:unpacked-set-example from unpacked-example-0.1.0.0). See the build log
above for details.

To Reproduce
Steps to reproduce the behavior:

Run cabal v2-build with above configuration.

Expected behavior

cabal build should succeed or print a message which can clearly pinpoint what is wrong. I tried going through the docs as well, but could not figure out what is wrong here. Did many trial and errors as well, but no luck with compiling this example.

System information

  • Operating system: Mac OSX
  • cabal version: 3.2
  • ghc version: 8.8.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions