Skip to content

Configuring llvm-sys on Windows

I have installed llvm 13.0.0 using the official LLVM installer. The tools seem to be installed correctly and available, e.g.

PS C:\Users\...\llvm-sys.rs> wasm-ld --version
LLD 13.0.0

but when I try to actually build llvm-sys (commit b88e2411), I get

error: No suitable version of LLVM was found system-wide or pointed
              to by LLVM_SYS_130_PREFIX.

              Consider using `llvmenv` to compile an appropriate copy of LLVM, and
              refer to the llvm-sys documentation for more information.

              llvm-sys: https://crates.io/crates/llvm-sys
              llvmenv: https://crates.io/crates/llvmenv
   --> src\lib.rs:487:1
    |
487 | / std::compile_error!(concat!(
488 | |     "No suitable version of LLVM was found system-wide or pointed
489 | |        to by LLVM_SYS_",
490 | |     env!("CARGO_PKG_VERSION_MAJOR"),
...   |
497 | |        llvmenv: https://crates.io/crates/llvmenv"
498 | | ));
    | |__^

I have set the variable:

PS C:\Users\...\llvm-sys.rs> $env:LLVM_SYS_130_PREFIX
C:\Program Files\LLVM

I think the actual problem is the absence of llvm-config. The default windows installer does not seem to come with this binary.

Is that correct? and if so, can we document that, and what are my options? Do I have to build LLVM from source?