ghc 9.12.2 won't use unsupported versions of llvm
Summary
ghc 9.12.2 won't use unsupported versions of llvm (llvm 20.1.1). This is a regression as in earlier versions it would.
Steps to reproduce
Install llvm 20.1.1. Compile hello.hs (main = putStrLn "hello") you will get the following
ghc -fllvm hello.hs
Loaded package environment from /Users/avie/.ghc/aarch64-darwin-9.12.2/environments/default
[1 of 2] Compiling Main ( hello.hs, hello.o )
<no location info>: error: [GHC-66599]
GHC was not configured with a supported LLVM toolchain
Make sure you have installed LLVM between [13 and 20) and reinstall GHC to make -fllvm work
Expected behavior
I expect it to do what it used to do: compile the file with a warning saying something like "You are using an unsupported version of llvm but will try to compile anyways."
Environment
ghc 9.12.2
- GHC version used: 9.12.2
Optional:
- Operating System: macos 15.4
- System Architecture: Aarch64
I believe this problem exists on 9.12.1 also. I think it would be good to fix this in ghc 9.12.3 and 9.14.1
In email on ghc-devs Andreas Klebinger wrote:
Looking at #25011 (closed) it seems the desire was to fail with a proper error when LLVM was not found at all.
To me failing when the llvm version is too new seems like a unintended side effect of fixing the former.