首页 > 解决方案 > 如何从构建中排除特定的板条箱类型?

问题描述

我的 Rust 项目依赖于 crate reqwest,它依赖于hyper.

当我为 Android 平台构建项目时

cargo.exe build --target aarch64-linux-android

cargo找不到cc

   Compiling hyper v0.14.4
error: linker `cc` not found

= note: The system cannot find the file specified. (os error 2)

error: aborting due to previous error

error: could not compile `hyper`.

hyper如果我从's中删除以下行Cargo.toml

[lib]
crate-type = ["lib", "staticlib", "cdylib"]

然后我可以毫无问题地构建我的项目。

hyper如何在不修改的情况下构建我的项目Cargo.toml?如何从构建中排除它的staticlibcdylibcrate 类型?

解决方案/解决方法

我为我的问题找到了解决方案/解决方法。我已添加到.cargo/config

[target.aarch64-linux-android]
linker = 'aarch64-linux-android28-clang.cmd'

现在hyper编译为lib,staticlibcdylib. 顺便说一句,cdylib想要的是板条箱类型cc

标签: androidrustrust-cargohyperreqwest

解决方案


解决方案/解决方法

我为我的问题找到了解决方案/解决方法。我已添加到.cargo/config

[target.aarch64-linux-android]
linker = 'aarch64-linux-android28-clang.cmd'

现在hyper编译为lib,staticlibcdylib. 顺便说一句,cdylib想要的是板条箱类型cc


推荐阅读