Hey all. Making a post for this as it covers a few of the common issues on Apple Silicon being posted here.
This includes:
LLVM version not being found
clang compilation problems
LLVM
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
Add /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:
You can check with clang --version
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:
/Library/Developer/CommandLineTools/usr/bin
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.: xcode-select --install
And, on a nearby note, if you need (or at least decide) to run some software in x86_64 mode: softwareupdate --install-rosetta
(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. )
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.)
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.)
I read that tutorial shortly after people were posting about it and, frankly, it seemed strange and overcomplicated (to put it politely.) I’m honestly not surprised if people could come out of it with an incomplete and/or fragile setup.
Glad to hear you got things sorted, of course. Have fun!
@mvdirty Yes, I agree, after all I would say it was more difficult to to get successfully through the whole installation process on an M1 than it was before on a macOS device.
Previously I was familiar with the manual installation process and my last two installations went without a hitch. Well, with the M1 it was a little different. My first attempt also with the manual process was unsuccessful, as was the automatic installation with the script.
So I tried it yesterday in a third attempt with the "How to" from barbegenerativediary, which is a variant of the automatic installation. Finally, the many tips, corrections and help here in the club - in this thread and others - were decisive for the success of the installation.
My thanks to the accumulated and shared knowledge of our community. Thank you all!
I helped someone install on a mac today who was having issues with LLVM. The answer was to install a newer ghc which doesn't use LLVM. I was happy to not have to install homebrew for them, or mess with any libraries.
That’s great news. The Haskell / Apple Arm story is still far from sorted (e.g. even Stack itself is still somewhat broken on arm at this point, IIRC) but getting there (e.g. the developer macbooks at my day job now actually run into less toolchain trouble on arm than on x86) and I love seeing every little step forward like this one.