Unable to generate bindings: ClangDiagnostic("wrapper.h:1:10: fatal error: 'z3.h' file not found\n")

⚓ Rust    📅 2025-12-01    👤 surdeus    👁️ 1      

surdeus

I am trying to set up Rust for the first time on windows, I managed to get hello world up and running, but now I need to compile the Z3 library (GitHub - prove-rs/z3.rs: Rust bindings for the Z3 solver.). Unfortunately I keep getting the error:

Unable to generate bindings: ClangDiagnostic("wrapper.h:1:10: fatal error: 'z3.h' file not found\n")

I have found this is supposed to be related to LLVM, so I downloaded LLVM (tried from LLVM Download Page, using winget, as well as some other site), set up LIBCLANG_PATH system variable to point at the .../LLVM/bin location (I also tried just .../LLVM or other subfolders) didnt work. Tho it did produce a different error, namely:

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: [])"

I checked the LLVM install folder for libclang.dll and clang.dll but it only contains libclang.lib and not libclang.dll which is apparently needed... I did find a bunch of files with long names such as clang_rt.asan_dynamic-x86_64.lib even one clang_rt.asan_dynamic-x86_64.dll or clang.exe but setting the LIBCLANG_PATH to any of them did nothing. I also tried searching how to install clang, but every source said it is installed by installing LLVM. Any ideas how to fix this error?

If it matters, I tried to build it in both RustRover as well as visual studio...
I also tried uninstalling everything rust related and reinstalling, same issue.

2 posts - 2 participants

Read full topic

🏷️ Rust_feed