当我试图交叉编译一些Rust时,我得到了这个错误;有人知道我应该做什么吗?
当我运行cargo build --target aarch64时发生这种情况,我得到:
Compiling glib-sys v0.10.1
error: failed to run custom build command for `glib-sys v0.10.1`
...
pkg-config has not been configured to support cross-compilation.
Install a sysroot for the target platform and configure it via
PKG_CONFIG_SYSROOT_DIR and PKG_CONFIG_PATH, or install a
cross-compiling wrapper for pkg-config and set it via
PKG_CONFIG environment variable.我可能在大约一年前就问过这个问题,但无论如何我找不到任何答案。我已经尝试在我的Cargo.toml中添加各种行,但似乎没有任何帮助。
Cargo.toml的相关部分有:
[target.'cfg(target_os = "android")'.dependencies]
cairo = "0.0.4"
freetype = "0.7.0"
glib = "0.14.2"
openssl = "0.10.36"
openssl-sys = {version = "0.9.66", features = ["vendored"]}可能只有一句话可以回答这个问题;有人能帮我吗?
发布于 2021-08-30 04:56:13
我也是rust的新手,所以我的答案中可能有一些错误。
因此,该警告表明pkg-config设置不正确,这表明这不是锈蚀问题,而是pkg-config问题。
如果您查看pkg-config的文档,您可能会看到有一个名为PKG_CONFIG_SYSROOT_DIR的环境变量,它“对于交叉编译很有用”。您需要做的是使用此环境设置运行cargo,例如PKG_CONFIG_SYSROOT_DIR=/usr/x86_64-w64-mingw32/ cargo build,其中/usr/x86_64-w64-mingw32包含windows交叉构建所需的所有文件(如名称所示)。
我不确定如何交叉编译aarch64,也不确定如何为cargo build添加环境变量,但我希望我上面的经验能给你一些提示。
https://stackoverflow.com/questions/68871193
复制相似问题