commercialhaskell / commercialhaskell/stack

`-fplugin` could not find module when using GHC 9.6

Open
#6,251 25 comments 1 reaction 0 assignees View on GitHub
resolution: upstream issue
Dominant language
Haskell
Stars
4.1k
Forks
850
Avg merge
10h 37m
Merged PRs (30d)
4

Description

When trying to build a project using [polysemy-plugin](https://github.com/polysemy-research/polysemy/tree/master/polysemy-plugin#readme) with GHC 9.6, the build fails with a strange error.

As far as I can tell this is a Stack issue, with the build command not including the `package-db` and `package` flags. GHC 9.4.7 works as intended

### Steps to reproduce

1. Clone this repository which contains a minimal reproducible example: https://github.com/knightzmc/psymy
2. Run `stack build`
3. It should throw an error
4. Change the `resolver` to `lts-21.12`
5. Build again
6. It should work

### Expected

Expected to build without errors or warnings.

### Actual

The final stage of building throws an error

~~~text
Installing library in /private/tmp/psymy/.stack-work/install/aarch64-osx/d648be467e8db3bbfce8aea3e8a40e40c2a4aa997e10a82332008572e1290566/9.6.2/lib/aarch64-osx-ghc-9.6.2/problematic-0.0.0.0-7Tqbt47XADvFA7jcxUQnZt
Error: Cabal-simple_6HauvNHV_3.10.1.0_ghc-9.6.2:
'/Users/alex/.ghcup/ghc/9.6.2/bin/ghc' exited with an error:
: Could not find module ‘Polysemy.Plugin’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.

Completed 14 action(s).

Error: [S-7282]
Stack failed to execute the build plan.

While executing the build plan, Stack encountered the error:

[S-7011]
While building package problematic-0.0.0.0 (scroll up to its section to see the error) using:
/Users/alex/.stack/setup-exe-cache/aarch64-osx/Cabal-simple_6HauvNHV_3.10.1.0_ghc-9.6.2 --verbose=1 --builddir=.stack-work/dist/aarch64-osx/Cabal-3.10.1.0 register
Process exited with code: ExitFailure 1
~~~

### Stack version

~~~text
stack --version
Version 2.11.1, Git revision d06506a16289c6b90e6ffc0dcc8be7f80487ac07 (dirty) aarch64 hpack-0.35.2
~~~

### Method of installation

* Via GHCup
* Also happens with Nix

### Platform

MacOS Sonoma aarch64, also reproducible on Ubuntu 22.04.2 LTS x86_64

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.