[Solved] Target.'not(cfg(target_os = "android"))'.dependencies

Hi,
openssl can be build from source when cross-compiling and the openssl library files for the target are not available on the build system.

[target.‘cfg(target_os = “android”)’.dependencies]
android_logger = “0.5”
openssl = { version = “=0.10.12”, optional = true, features=[“vendored”] }

Now for all other target OS I want to use the original dependency, but rustc complains about

error[E0463]: can't find crate for `openssl`
 --> src/utils/crypto/hash/openssl.rs:1:1
  |
1 | extern crate openssl;
  | ^^^^^^^^^^^^^^^^^^^^^ can't find crate

So, I guess, this line is not working as I think it should:


[target.‘not(cfg(target_os = “android”))’.dependencies]

openssl = { version = "=0.10.12", optional = true }

How do I say in Cargo.toml “if the target_os is android use the feature ‘vendored’ for the openssl crate”?

Thanks
Axel

Found it myself in another crate.

[target.'cfg(not(target_os = "android"))'.dependencies]

openssl = { version = "=0.10.12", optional = true }

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.