haskell / haskell/cabal

`-fforce-recomp` isn't observed by cabal anymore

Open
#7,496 6 comments 0 reactions 0 assignees View on GitHub
cabal-install: other
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**Describe the bug**
Whether put as a `ghc-options` or as a pragma in source code, `cabal-install` doesn't seem to observe `-fforce-recomp`

**To Reproduce**
```bash
$ mkdir RecompCode
$ cd RecompCode
$ cabal init
$ sed -i '1s/^/{-# OPTIONS_GHC -fforce-recomp #-} \n/' app/Main.hs
$ cabal v2-build

Resolving dependencies...
Build profile: -w ghc-8.10.4 -O1
In order, the following will be built (use -v for more details):
- RecompileCode-0.1.0.0 (exe:RecompileCode) (first run)
Configuring executable 'RecompileCode' for RecompileCode-0.1.0.0..
Preprocessing executable 'RecompileCode' for RecompileCode-0.1.0.0..
Building executable 'RecompileCode' for RecompileCode-0.1.0.0..
[1 of 1] Compiling Main ( app/Main.hs, /home/hecate/Code/RecompileCode/dist-newstyle/build/x86_64-linux/ghc-8.10.4/RecompileCode-0.1.0.0/x/RecompileCode/build/RecompileCode/RecompileCode-tmp/Main.o )
[1 of 1] Compiling Main ( app/Main.hs, /home/hecate/Code/RecompileCode/dist-newstyle/build/x86_64-linux/ghc-8.10.4/RecompileCode-0.1.0.0/x/RecompileCode/build/RecompileCode/RecompileCode-tmp/Main.o )
Linking /home/hecate/Code/RecompileCode/dist-newstyle/build/x86_64-linux/ghc-8.10.4/RecompileCode-0.1.0.0/x/RecompileCode/build/RecompileCode/RecompileCode ...

$ cabal v2-build
Up to date
```

**Expected behavior**
Compilation should happen again

**System information**
- Fedora 34
- cabal-3.4.0.0
- ghc-8.10.4

Contributor guide

Open the contributing guide

Research direction

Reproduce the report in a minimal project created with `cabal init`, using `app/Main.hs`, the `OPTIONS_GHC` pragma, and `cabal v2-build`. Trace how `cabal-install` handles `-fforce-recomp` from `ghc-options` and source pragmas; done means a second `cabal v2-build` compiles again instead of reporting `Up to date`.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.