Package fails to build only as source-repository-package dependency, only in certain contexts
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
**Describe the bug**
A [simple Haskell package](https://github.com/wenkokke/shoggoth/tree/949a43cab17aff6d49653d24e1a021898a7d4aa4) with helper functions builds just fine, both as a [standalone package](https://github.com/wenkokke/shoggoth/actions/runs/2421911864) and as a [source-repository-package dependency in one context](https://github.com/wenkokke/wenkokke.github.io/actions/runs/2422001191), but fails to build as a source repository package in a different context.
**To Reproduce**
Steps to reproduce the behavior:
1. Download [this code](https://github.com/plfa/plfa.github.io/archive/f682838a917036a94f34af79a49f6829e56c0d00.zip)
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**
...
Contributor guide
Research direction
Download and unpack the linked PLFA archive, then reproduce the failure with `cabal v2-build`. Start with the `shoggoth/Shoggoth/Metadata.hs` imports and the package's `build-depends`, then trace how Cabal handles the source-repository-package context; done means explaining the hidden `aeson` failure and establishing whether the package builds or reports a more accurate error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100