IT技术之家

首页 > 编程

编程

rust环境搭建时解决clang.dll libclang.dll缺失的问题(windows环境)_libclang安装_weixin_47450271

发布时间:2023-11-28 20:57:40 编程 31次 标签:rust windows 开发语言
Unable to find libclang: "couldn't find ar my valid shared libraries matching: ['clang.dll', 'libclang.dll'l, set the LIBCLANG_PATH environment variable to a path where one of these files can be found (invalid [])"',...

遇到的问题:

提示:该解决方法是在搭建好gcc和llvm的环境下进行的

Caused by:
process didn't exit successfully:`D:\move\aptos-core\target\debug\bi uild\1ibrocksdb-sys-d057bc8fdb7883b6\build-script-build`(exit code: 101) --- stderr
thread 'main'panicked at 'Unable to find libclang: "couldn't find ar my valid shared libraries matching: ['clang.dll', 'libclang.dll'l, set the LIBCLANG_PATH environment variable to a path where one of these files can be found (invalid [])"',C:\Users\12045\.cargo\registry\src\github.com1ecc6299db9ec823\6?2172:31
note: run with `RUST BACKTRACE=1` environment variable to display a l backtrace

warning: build failed, waiting for other jobs to finish...

在已经安装llvm(内涵libclang.ddl,clang.exe等)和gcc的情况下,设置了系统的环境变量后,运行cargo命令依然报错提示“Unable to find libclang”,经历了一天的摸爬滚打才解决,所以现在记录一下解决方法。

解决方法:

报错信息提示需要设置LIBCLANG_PATH的环境变量即使设置了llvm和gcc的环境变量之后还报错,通过export -p 查看vscode识别的环境变量

?果然没有找到LIBCLANG_PATH环境变量的设置

最后通过 export?LIBCLANG_PATH="D:\\LLVM\\bin"? ?

注意:windows下通过export设置环境变量与linux不同,需要转义字符”\“,不需要$?加LIBCLANG_PATH

再次export -p 检查是否设置成功

最后运行cargo相关命令即可成功

?