Is there a pre-built clang library for Windows?

There are pre-built LLVM/clang binaries on Zig's github page:
https://github.com/ziglang/zig/wiki/Building-Zig-on-Windows

You can find libclang.dll in the bin folder.

The currently available versions are:

  • llvm+clang-6.0.0-win64-msvc-release.tar.xz
  • llvm+clang-7.0.0-win64-msvc-release.tar.xz
  • llvm+clang-8.0.0-win64-msvc-release.tar.xz
  • llvm+clang-9.0.0-win64-msvc-release.tar.xz
  • llvm+clang+lld-10.0.0-x86_64-windows-msvc-release-mt.tar.xz

There are also detailed build instructions, here.


For anyone coming to this question that's just looking to install libclang on their system, the choco llvm package appears to install libclang correctly. I can't speak to whether this is adequate for actually linking against this library for C/C++, but it worked for my case.

Just run this in an elevated command prompt or powershell:

choco install llvm

You may need to run refreshenv or open a new console for tools to pick this up.

In my case, and to help with future googlers (since I couldn't find a simple answer elsewhere) my issue was specifically while trying to compile a Rust project that made use of the onig_sys crate:

   Compiling onig_sys v69.2.0
error: failed to run custom build command for `onig_sys v69.2.0`

Caused by:
  process didn't exit successfully: `[redacted]\target\debug\build\onig_sys-b53394f57ee5e2c5\build-script-build` (exit code: 101)
--- stdout
cargo:warning=couldn't execute `llvm-config --prefix` (error: The system cannot find the file specified. (os error 2))
cargo:warning=set the LLVM_CONFIG_PATH environment variable to a valid `llvm-config` executable

--- stderr
thread 'main' panicked at 'Unable to find libclang: "couldn\'t find any valid shared libraries matching: [\'clang.dll\', \'libclang.dll\'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"', src\libcore\result.rs:1188:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

After installing llvm, the cargo build finished successfully

Tags:

Windows

Dll

Clang