llvm-sys-找不到可用的系统范围内的LLVM

时间:2019-11-24 06:14:25

标签: rust llvm

我正在尝试学习LLVM,以使用Rust编写编程语言。我正在使用环绕LLVM API的llvm-sys条板箱。

我已经安装了LLVM:LLVM-8.0.0-win64

我对cargo.toml的依赖

[dependencies]
llvm-sys = "80.1.1"

运行cargo run时出现以下错误,

    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.

但是我将LLVM_SYS_80_PREFIX设置为C:\Program Files\LLVM,这是bin文件夹所在的位置。

llvm-config文件是否应单独安装?我在任何地方都找不到。

仅供参考:我在Windows 10上

感谢您的帮助!

2 个答案:

答案 0 :(得分:1)

LLVM 未附带名为 llvm-config.exe 的组件,但我不确定如何绕过。

答案 1 :(得分:1)

llvm-config 是一个开发者端工具,它不附带二进制文件。您需要从源代码构建 LLVM。