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.)
@tillmanjex How do I do this? How do I add /usr/local/opt/llvm@13/bin` to my $PATH ?
It seems that I have the same issues on a M1 Macbook.
Always grateful for your help,
All of the common installation methods for llvm should add it to the path. How did you install llvm?
I used this tutorial:
and in the meantime I used this advise for adding a path:
Now TC runs fine. Thank you for your help.
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.
To see what versions are installed and available:
You might have to do this first:
I did this:
ghcup install ghc 9.2.3
ghcup set ghc 9.2.3
Or to just install the latest I think you can do:
ghcup install ghc latest
ghcup set ghc latest
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.
I've updated the install script. Hope it doesn't break things more.. Fiddle with ghcup settings to install latest haskell · tidalcycles/tidal-bootstrap@52f77ec · GitHub
This script could be significantly improved, if any mac users fancy a go (I don't have access to one):