Mac上Cargo编译错误: failed to run custom build command for '*.*'

发布时间:2019-06-18 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了Mac上Cargo编译错误: failed to run custom build command for '*.*'脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

编译Rust的项目时候出现了错误:

error: failed to run custom build command for croaring-Sys v0.3.7
PRocess didn't exIT successfully: /Users/.../grin/target/release/build/croaring-sys-20d6d5c35e3a436a/build-script-build (exit code: 101)
--- stdout
TARGET = Some("x86_64-apple-darwin")
OPT_LEVEL = Some("3")
HOST = Some("x86_64-apple-darwin")
CC_x86_64-apple-darwin = None
CC_x86_64_apple_darwin = None
HOST_CC = None
CC = None
CFLAGS_x86_64-apple-darwin = None
CFLAGS_x86_64_apple_darwin = None
HOST_CFLAGS = None
CFLAGS = None
DEBUG = Some("false")
running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-Wall" "-Wextra" "-std=c11" "-mArch=native" "-O3" "-o" "/Users/.../grin/target/release/build/croaring-sys-4f7af44253f571e8/out/CRoaring/roaring.o" "-c" "CRoaring/roaring.c"

关键的错误信息是:

error: unknown tyPE name 'uint64_t' cargo:warning= uint64_t ri resident_size;

原因是升级了MAC系统之后 C++ .h 不正确造成的。
解决的方式,是删除clang相关的编译环境,并重新安装,首先删除头文件:

rm -rf /usr/local/include/*

再卸载LLVM相关的工具链

brew uninstall llvm

最后需要卸载掉xcode命令行工具:

rm -rf /Library/Developer/CommandLinetools

卸载掉clang相关工具之后,再重新安装。
安装Xcode命令行工具:

xcode-select --install

安装llvm

brew install --with-toolchain llvm

重新编译正常

脚本宝典总结

以上是脚本宝典为你收集整理的Mac上Cargo编译错误: failed to run custom build command for '*.*'全部内容,希望文章能够帮你解决Mac上Cargo编译错误: failed to run custom build command for '*.*'所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。