commercialhaskell / commercialhaskell/stack

Discourage messing with boot packages

Open
#6,706 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
4.1k
Forks
850
Avg merge
10h 37m
Merged PRs (30d)
4

Description

### General summary/comments (optional)

When failing to produce a build plan due to a constraint on a boot package, warn that overriding the version for the boot package has more cascading implications than for a regular package (cf `[S-4804]`)

### Steps to reproduce

Trying to build current Ormolu HEAD (`2db4b1f761caf6b9092f5702937bfc075ad56534`) against `lts-23.17` ^[not a bug for them, I just try to cut down on the number of different LTSs I build against on my machine] I get

```
Error: [S-4804]
Stack failed to construct a build plan.

While constructing the build plan, Stack encountered the following errors. The 'Stack
configuration' refers to the set of package versions specified by the snapshot (after any dropped
packages, or pruned GHC boot packages; if a boot package is replaced, Stack prunes all other such
packages that depend on it) and any extra-deps:

In the dependencies for ghc-lib-parser-9.12.1.20250105:
* filepath must match >=1.5 && <1.6, but filepath-1.4.301.0 is in the Stack configuration (latest
matching version is 1.5.4.0).
The above is/are needed due to ormolu-0.8.0.0 -> ghc-lib-parser-9.12.1.20250105

Some different approaches to resolving some or all of this:

* To ignore all version constraints and build anyway, pass --allow-newer, or, in
/home/gesh/.local/share/stack/config.yaml (global configuration) or
/home/gesh/aur/1+mine/static/ormolu-static-git/src/ormolu-static-git/stack.yaml (project-level
configuration), set allow-newer: true.

* To ignore certain version constraints and build anyway, also add these package names under
allow-newer-deps: ghc-lib-parser.

* Recommended action: try adding the following to your extra-deps in
/home/gesh/aur/1+mine/static/ormolu-static-git/src/ormolu-static-git/stack.yaml
(project-level configuration):

- filepath-1.5.4.0@sha256:099c33e0e570dad93390e1c01c1f4bc6e4f13587de8e199df3c94a6cb62c7434,4945
```

Note the recommendation to pin a specific version of `filepath` -- a boot package. However, pinning that means pinning every package depending on it (in my case, `directory`, `process`, and `unix`). Moreover, the intermediate states are confusing, given that despite the `lts` specifying e.g. `unix-2.8.6.0`, I still need to manually specify it in `stack.yaml` for it to be picked up -- as `stack ls dependencies` confirms (it, too, could warn on this).

(Incidentally, `--allow-newer-deps` didn't help here, and was actually a misnomer -- it made `stack` try to build against an _older_ version of `filepath` than `ghc-lib-parser` wanted, which failed)

I expected the recommended solution to have a caveat warning the package was a boot package, and perhaps a recommendation away from respecifying boot packages

### Stack version

~~~text
stack --version
Version 3.5.1, Git revision 5c774d7ca92f4716ef7a51d5da21a5c3713517a5 x86_64 hpack-0.38.0
~~~

### Method of installation

https://aur.archlinux.org/packages/stack-static

### Platform

Arch Linux

Related: #4897

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.