Cabal and llvm issue

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

Can you run opt --version manually in the terminal?

I get the following
Homebrew LLVM version 13.0.0

The error message says >= 9 && < 13. Not the round parentheses on the right.

Does homebrew really inject their name in there? :man_facepalming: Maybe that’s tripping ghc up as well. The version warning is usually not a hard failure.

I can compile Haskell programs with GHC 8.10.7 and Homebrew LLVM 13.0 on my MacBook Pro 2018 without errors or warnings.

GHC is working fine, it is the issue with cabal. When I try to build with cabal, i get this error.

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.

Thank you. ghc-options: -fllvm worked.
I just added this a part of common shared-properties stanza

Interesting… I didn’t know that it is possible to get that error if you did not use -fllvm, I thought that was a requirement for using LLVM with GHC.