My Rust project depends on crate reqwest
which depends on hyper
.
When I build my project for Android platform
cargo.exe build --target aarch64-linux-android
cargo
cannot find 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`.
If I remove the following lines from hyper
's Cargo.toml
[lib]
crate-type = ["lib", "staticlib", "cdylib"]
then I can build my project without problems.
How can I build my project without modifying hyper
's Cargo.toml
? How exclude its staticlib
and cdylib
crate types from the build?
SOLUTION / WORKAROUND
I found a solution/workaround for my issue. I've added to .cargo/config
:
[target.aarch64-linux-android]
linker = 'aarch64-linux-android28-clang.cmd'
Now hyper
is compiled as lib
, staticlib
and cdylib
. And by the way, it was the cdylib
crate type who wanted cc
.
SOLUTION / WORKAROUND
I found a solution/workaround for my issue. I've added to .cargo/config
:
[target.aarch64-linux-android]
linker = 'aarch64-linux-android28-clang.cmd'
Now hyper
is compiled as lib
, staticlib
and cdylib
. And by the way, it was the cdylib
crate type who wanted cc
.