UnrealBuildTool can't find clang on Windows

Hi, I’d like to generate a clang compilation database for my project but have had trouble getting UBT to recognize clang on my machine.
I’ve tried both the version from the LLVM site (enabling the “add to path” option in the installer) and the version from the Visual Studio installer (temporarily adding clang’s bin directory to the path myself and setting CC and CXX to the correct values). Here’s the command I ran in powershell:

& 'Path\To\Build.bat' -mode=GenerateClangDatabase -project="Path\To\BatteryCollector\BatteryCollector.uproject" BatteryCollector Development Win64

The output is as follows:

ERROR: Clang must be installed in order to build this target.

Am I doing anything wrong?

I have tried looking at the UBT source code and have found where the error is emitted but it’s just a rabbit hole of classes and factory methods and I’m having a hard time finding where exactly it looks for clang.

I’m using version 4.25.3 but have faced the same issues with 4.25.2.

From what I can tell, it looks like the UBT expects Clang to be installed at C:\Program Files\LLVM. The UBT specifically verifies that the following file exists: C:\Program Files\LLVM\bin\clang-cl.exe

So I symbolically linked C:\Program Files\LLVM to the folder where I manually built LLVM/Clang. That seems to work, and I am able to generate the compilation database. It’s not my ideal solution, so if anyone has another suggestion, I’d be interested in hearing it!

Hope this helps!

Facing the same issue here in Linux. And I can’t also find where that error code is being generated, no clue why it cannot find clang which is installed in my system.