Skip to content

ghc-options applies to all dependencies, not just local packages #3883

Closed
@edsko

Description

@edsko

With traditional build, I would use

cabal build --ghc-option=-ddump-simpl

If I try the same with new-build, it starts to rebuild every single dependency; presumably because it considers the compiler flags for all dependencies to have changed. I tried to do

packages: ingest.cabal

profiling: True
executable-profiling: True
constraints: Cabal >= 1.24

program-options
  ghc-options: -fprof-auto 

package ingest
  ghc-options: -ddump-simpl -ddump-to-file

but although it doesn't complain about the ghc-options inside the package section, it doesn't seem to take it into account either; no dump files get created. What is the right approach?


edit by @23Skidoo: Currently recommended workaround is to add a cabal.project that enables ghc-options for each package separately:

package foo
  ghc-options: -Werror

package bar
  ghc-options: -Werror

Cabal's own CI uses this approach.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions