Intermittent compiler error: `Couldn't figure out C compiler information!`

I’m using GHC 9.0.1 on an M1 Mac and I’m seeing the following error, but only at what seems random intervals:

<no location info>: error:
    Warning: Couldn't figure out C compiler information!
             Make sure you're using GNU gcc, or clang
clang: warning: argument unused during compilation: '-fno-common' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-U __PIC__' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-D __PIC__' [-Wunused-command-line-argument]

At other times everything compiles without these notices.

Before I bother the GHC maintainers with this issue, is this something I haven’t setup correctly in macOS and GHCUP?

TIA,

Stu

I believe you are running an x86_64 ghc via rosetta2 on your mac. The issue could not figure out c compiler you are seeing is curious bug in GHCs that is only exhibited when running via rosetta2. This is fixed in 9.2 and this was back posted to 8.10.6 as well as 9.0.2 I believe. 9.2.1 and 9.0.2 releases should happen soon.

2 Likes

Thanks for that very clear explanation.

ghcup should work on M1 and pull the native GHC for you: https://downloads.haskell.org/~ghcup/0.1.16.2/aarch64-apple-darwin-ghcup-0.1.16.2

2 Likes

Excellent – thanks.