I am using MacBook and I have installed LLVM@13 using brew install. I have changed .zshrc file also.
export PATH=/opt/homebrew/opt/llvm/bin:/opt/homebrew/bin:$PATH
export LDFLAGS="-L/opt/homebrew/opt/llvm/lib"
export CPPFLAGS="-I/opt/homebrew/opt/llvm/include"
I still get the following error when I run cabal build. Am I still missing something.
: error:
Warning: Couldn’t figure out LLVM version!
Make sure you have installed LLVM between [9 and 13)
ghc: could not execute: opt
Compiling with cabal and llvm also works for me. Specifically, creating a new project, adding ghc-options: -fllvm and then running cabal build works for me.
For real?? So much for computers adapting to humans so that we didn’t have to adapt to them… I thought it was a typo of some sort.
Anyway, thanks for translating this. Now I’ve learned that Haskell tools will do something like this to me next time I see an error, and hopefully solve my problem sooner
GHC will default to -fllvm if there is no native code Gen for the target. (AArch64-darwin) only had a NCG from 9.2 onwards. 8.10 will be -fllvm by default.
In case it helps others, adding ghc-options: -fllvm to my haskell.cabal did help with my initial issue running cabal v2-run, but did not help with calls such as cabal install ...
To fix that I had to use brew install llvm@12 rather than brew install llvm and update the $PATH as suggested.
Hopefully llvm version 13.x will be supported in the future