Similar issue when building GHC via Homebrew on macOS 10.15.7. Editing hsc2hs-ghc-9.4.7
, as suggested by @ppelletiin, in the build temp folder (private/tmp/ghc-20231025-34404-m1k5l2/ghc-9.6.2/binary/bin/hsc2hs-ghc-9.4.7
) as soon as it was created resolved the issue.