Skip to content

Cabal package not visible to build auto-generated setup.hs #11416

@andreasabel

Description

@andreasabel

After upgrading cabal from 3.16.0.0 to 3.16.1.0, cabal test chokes on the auto-generated setup.hs.

$ cabal test
Build profile: -w ghc-9.12.2 -O1
In order, the following will be built (use -v for more details):
 - stack-snapshots-0.1.0.0 (test:stack-snapshots-test) (first run)
[1 of 2] Compiling Main             ( dist-newstyle\build\x86_64-windows\ghc-9.12.2\stack-snapshots-0.1.0.0\t\stack-snapsh
ots-test\setup\setup.hs, dist-newstyle\build\x86_64-windows\ghc-9.12.2\stack-snapshots-0.1.0.0\t\stack-snapshots-test\setu
GHC-87110)
         dist-newstyle\build\x86_64-windows\ghc-9.12.2\stack-snapshots-0.1.0.0\t\stack-snapshots-test\setup\setup.hs:2:1: error: [G
HC-87110]
    Could not load module `Distribution.Simple'.
    It is a member of the hidden package `Cabal-3.14.1.0'.
    Perhaps you need to add `Cabal' to the build-depends in your .cabal file.
  |
2 | import Distribution.Simple; main = defaultMain
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^

The problem is fixed by running cabal build --enable-tests.

I guess it would make sense that cabal test includes a cabal build --enable-tests if things are out-of-date.

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