Skip to content

Package fails to build only as source-repository-package dependency, only in certain contexts #8187

Open
@wenkokke

Description

@wenkokke

Describe the bug
A simple Haskell package with helper functions builds just fine, both as a standalone package and as a source-repository-package dependency in one context, but fails to build as a source repository package in a different context.

To Reproduce
Steps to reproduce the behavior:

  1. Download this code
  2. Unzip it
  3. From within the directory, run cabal v2-build

The command fails with the following error message:

[11 of 16] Compiling Shoggoth.Metadata ( shoggoth/Shoggoth/Metadata.hs, dist/build/Shoggoth/Metadata.o, dist/build/Shoggoth/Metadata.dyn_o )

shoggoth/Shoggoth/Metadata.hs:25:1: error:
    Could not load module ‘Data.Aeson.Key’
    It is a member of the hidden package ‘aeson-2.0.2.0’.
    Perhaps you need to add ‘aeson’ to the build-depends in your .cabal file.
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
25 | import Data.Aeson.Key qualified as Key
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

shoggoth/Shoggoth/Metadata.hs:26:1: error:
    Could not load module ‘Data.Aeson.KeyMap’
    It is a member of the hidden package ‘aeson-2.0.2.0’.
    Perhaps you need to add ‘aeson’ to the build-depends in your .cabal file.
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
   |
26 | import Data.Aeson.KeyMap qualified as KeyMap
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cabal: Failed to build shoggoth-0.1 (which is required by exe:builder from
plfa-20.10). See the build log above for details.

However, aeson is verifiably in build-depends!

Expected behavior
The package builds just fine, or at least fails with a different error message.

System information

  • macOS 11.6.5
┌─────────────────────────────────────GHCup────────────────────────────────────┐
│    Tool  Version         Tags                          Notes                 │
│──────────────────────────────────────────────────────────────────────────────│
│✔✔  GHCup 0.1.17.8        latest,recommended                                  │
│──────────────────────────────────────────────────────────────────────────────│
│✔✔  Stack 2.7.5           latest,recommended                                  │
│✗   Stack 2.7.3                                                               │
│──────────────────────────────────────────────────────────────────────────────│
│✔✔  HLS   1.7.0.0         latest,recommended                                  │
│✗   HLS   1.6.1.0                                                             │
│✗   HLS   1.5.1                                                               │
│✗   HLS   1.5.0                                                               │
│✗   HLS   1.4.0                                                               │
│──────────────────────────────────────────────────────────────────────────────│
│✔✔  cabal 3.6.2.0         latest,recommended                                  │
│✗   cabal 3.4.1.0                                                             │
│──────────────────────────────────────────────────────────────────────────────│
│✗   GHC   9.2.3           latest,base-4.16.2.0                                │
│✓   GHC   9.2.2           base-4.16.1.0                 hls-powered           │
│✗   GHC   9.0.2           base-4.15.1.0                 hls-powered           │
│✔✔  GHC   8.10.7          recommended,base-4.14.3.0     hls-powered           │
└──────────────────────────────────────────────────────────────────────────────┘

Additional context
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions