Reputation: 123
I'm trying to learn LLVM to make a programming language using Rust. I am using the llvm-sys
crate that wraps around the LLVM API.
I have installed LLVM : LLVM-8.0.0-win64
My dependencies in cargo.toml
[dependencies]
llvm-sys = "80.1.1"
When I run cargo run
I get the following error,
Updating crates.io index
Compiling memchr v2.2.1
Compiling lazy_static v1.4.0
Compiling regex-syntax v0.6.12
Compiling semver-parser v0.7.0
Compiling libc v0.2.65
Compiling cc v1.0.47
Compiling thread_local v0.3.6
Compiling semver v0.9.0
Compiling aho-corasick v0.7.6
Compiling regex v1.3.1
Compiling llvm-sys v80.1.1
error: failed to run custom build command for `llvm-sys v80.1.1`
Caused by:
process didn't exit successfully: `C:\Users\Name\Desktop\Carbon\carbon-lang\target\debug\build\llvm-sys-ed5d351b1ae6a41b\build-script-build` (exit code: 101)
--- stdout
cargo:rerun-if-env-changed=LLVM_SYS_80_PREFIX
cargo:rerun-if-env-changed=LLVM_SYS_80_IGNORE_BLACKLIST
cargo:rerun-if-env-changed=LLVM_SYS_80_STRICT_VERSIONING
cargo:rerun-if-env-changed=LLVM_SYS_80_NO_CLEAN_CFLAGS
cargo:rerun-if-env-changed=LLVM_SYS_80_USE_DEBUG_MSVCRT
cargo:rerun-if-env-changed=LLVM_SYS_80_FFI_WORKAROUND
Didn't find usable system-wide LLVM.
--- stderr
thread 'main' panicked at 'Failed to execute "C:\\Program Files\\LLVM\\bin\\llvm-config": Os { code: 2, kind: NotFound, message: "The system cannot find the file specified." }', src\libcore\result.rs:1165:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
But I have set the LLVM_SYS_80_PREFIX
as C:\Program Files\LLVM
which is where the bin folder is.
Should the llvm-config
file be separately installed? I could not find it anywhere.
I'm on Windows 10
Upvotes: 3
Views: 1621
Reputation: 790
Silly mistake but hopefully I can help someone not doing the same:
I was using Administrator: Developer PowerShell for VS 2022
and received the same error could not find a usable LLVM
and also
making sure my LLVM_SYS_150_PREFIX
variable was set.
making sure the path does not contain spaced (also apparently a possible cause for this error)
setx LLVM_SYS_150_PREFIX "c:\LLVM" /M
now here's the clue:
on PowerShell echo %LLVM_SYS_150_PREFIX%
shows %LLVM_SYS_150_PREFIX%
not the PATH
variable.
using Administrator: Developer Command Prompt for VS
shows c:LLVM
correctly and when doing a cargo install xxx
and Compiling llvm-sys v150.2.1
no issues cause it could read my PATH
variable.
Upvotes: 0
Reputation: 9324
llvm-config is a developer-side tool, it is not shipped with binaries. You need to build LLVM from sources.
Upvotes: 1
Reputation: 5
LLVM is not shipped with a component called llvm-config.exe, I am not sure how to bypass though.
Upvotes: 1