Skip to content

ghc `-E -cpp` doesn't behave the same for GHC 9.4 as GHC 9.2

Summary

Building with GHC 9.4 gives:

Error: cabal-3.8.1.0: Spec.hs doesn't exist

even though things were fine with GHC 9.2

Steps to reproduce

darcs clone https://hub.darcs.net/vmchale/apple
cabal build apple-test -w ghc-9.4

I ran cabal with -v3 to see that GHC is invoked like so:

/home/vanessa/.ghcup/bin/ghc-9.4 -E -cpp -x hs -optP-include -optP/development/haskell/apple/dist-newstyle/build/x86_64-linux/ghc-9.4.1/apple-0.1.0.0/t/apple-test/build/apple-test/autogen/cabal_macros.h -o /development/haskell/apple/dist-newstyle/build/x86_64-linux/ghc-9.4.1/apple-0.1.0.0/t/apple-test/build/apple-test/apple-test-tmp/Spec.hs test/Spec.cpphs '-D__GLASGOW_HASKELL__=904' '-Dlinux_BUILD_OS=1' '-Dx86_64_BUILD_ARCH=1' '-Dlinux_HOST_OS=1' '-Dx86_64_HOST_ARCH=1' -hide-all-packages

which is basically the same as GHC 9.2:

/home/vanessa/.ghcup/bin/ghc-9.2 -E -cpp -x hs -optP-include -optP/development/haskell/apple/dist-newstyle/build/x86_64-linux/ghc-9.2.4/apple-0.1.0.0/t/apple-test/build/apple-test/autogen/cabal_macros.h -o /development/haskell/apple/dist-newstyle/build/x86_64-linux/ghc-9.2.4/apple-0.1.0.0/t/apple-test/build/apple-test/apple-test-tmp/Spec.hs test/Spec.cpphs '-D__GLASGOW_HASKELL__=902' '-Dlinux_BUILD_OS=1' '-Dx86_64_BUILD_ARCH=1' '-Dlinux_HOST_OS=1' '-Dx86_64_HOST_ARCH=1' -hide-all-packages

However, the former fails while the latter works!

Expected behavior

It should work as it does with

cabal build apple-test -w ghc-9.2

Environment

  • GHC version used: 9.4, 9.2

Optional:

  • Operating System: Ubuntu 20.04
  • System Architecture: x86_64
Edited by Vanessa McHale
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information