haskell / haskell/cabal

Build tool not rerun when build tool version changes

Open
#11,411 3 comments 2 reactions 1 assignee Claimed by @sheaf View on GitHub
Cabal: cmd/build re: build-tool recompilation
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

Reproducer using cabal-3.16.1.0 (latest release):

Step 1: using alex-3.4
```
cabal get java-adt-1.0.20251105
cd java-adt-*
cabal build -c 'any.alex==3.4.*'
```
This errors:
```
dist-newstyle/build/aarch64-osx/ghc-9.8.4/java-adt-1.1/x/java-adt/build/java-adt/java-adt-tmp/Lexer.hs:771:25: error: [GHC-87543]
Ambiguous occurrence ‘fromString’.
It could refer to
either ‘String1.fromString’,
imported from ‘String1’ at src/Lexer.x:3:26-35,
or ‘GHC.Exts.fromString’,
imported from ‘GHC.Exts’ at dist-newstyle/build/aarch64-osx/ghc-9.8.4/java-adt-1.1/x/java-adt/build/java-adt/java-adt-tmp/Lexer.hs:20:1-15
(and originally defined in ‘Data.String’).
|
771 | alex_action_21 = TkId . fromString
| ^^^^^^^^^^
```
(Cf. https://hackage.haskell.org/package/java-adt-1.0.20251105/reports/2)

Step 2: using alex-3.5
```
cabal build -c 'any.alex==3.5.*'
```
Still fails with the same error.

Step 3: using alex-3.5 after cleaning
```
rm -rf dist-newstyle
cabal build -c 'any.alex==3.5.*'
```
Succeeds.

This shows that `Lexer.hs` is not regenerated by `alex` when its version is changed.
This is an unsoundness in the "recompilation" checker of cabal.

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.