Hey all. Making a post for this as it covers a few of the common issues on Apple Silicon being posted here.
- LLVM version not being found
- clang compilation problems
It seems that cabal doesn't see the native install of LLVM that ships with Mac. The error messages for me were noting that a version between 9 - 13 was requested.
- Download LLVM v13 via homebrew:
brew install llvm@13
/usr/local/opt/llvm@13/bin to your $PATH.
- Restart your terminal and try again.
Clang Compilation Problems
LLVM v13 comes with clang, but I was still getting clang compilation problems:
(or GHC tried to execute clang incorrectly)
It seems that GHC gets confused about which architechture it's running on(?)...
Which could make sense, as the clang version of LLVM I had was targeting x86_64 intel architecture, even though I'm on a fresh m1max mbp.
You can check with
Then you can change the arch of your shell to match that of your clang target, and try compiling again.
Here is how to do that..
But what worked for me is I used the Apple command line tools clang instead by updating XCode and adding it to my $PATH:
The developer tools version is targeting arm64, which is what makes me believe that worked for me.
Alternatively, you can address all of the above in one fell swoop, by running the official process by which to ensure you have appropriate versions of llvm, clang, etc.:
And, on a nearby note, if you need (or at least decide) to run some software in x86_64 mode:
(TBH, if I weren’t so completely and utterly slammed with work and other projects right now, I’d try to contribute some documentation updates. There are far too many threads, discord discussions, etc. like this one where people are jumping through extra hoops, installing extra tools like brew to help jump through them, etc. instead of using the official tools. )
I already had xcode and rosetta installed. But neither were being used it seems...
Did you have Xcode, Xcode and the Xcode command line tools, or just the Xcode command line tools? (Of those it is the Xcode command line tools install which is critical in this instance.)
Not experienced enough to say exactly, but I installed with
During this troubleshooting I then updated the CLI tools.
Hmm, another thing that does come to mind regarding various people’s issues locating installed dependencies is that if people are hacking around in the shared zshrc, for example, it is often overwritten/reverted during operating system updates. I’ve had to fix that up a couple of times in recent months, for some work-related development dependencies which require the information to be in the shared zshrc rather than in my user’s .zshrc.
Long story short: if people are having to fix things up, perhaps make sure to do so in the user’s .zshrc rather than the shared one, and consider backing both up before O/S updates (both because some installers will modify the shared one, even if it might be better if they updated the user’s one.)