Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cargo.toml should allow specifying different features based on target #3741

Closed
debris opened this issue Feb 21, 2017 · 1 comment
Closed

Comments

@debris
Copy link
Contributor

debris commented Feb 21, 2017

That's my Cargo.toml

[package]
name = 'foo'
version = '0.1.0'

[target.'cfg(target_os="android")'.dependencies]
bar = { version = "0.9", default-features = false }

[target.'cfg(non(target_os="android"))'.dependencies]
bar = { version = "0.9", default-features = true }

I compile the above library twice:

  • with plain cargo build
  • and with cargo build --target aarch64-linux-android

I expect android binary to have bar's default features turned off. Unfortunately, they are on.

If I comment out

#[target.'cfg(target_os="android")'.dependencies]
#bar = { version = "0.9", default-features = false }

Android cross compilation fails with can't find crate 'bar' as expected.


tl;dr

specifying different features for the same library, based on target, does not work

@alexcrichton
Copy link
Member

I believe this is a dupe of #1197, but thanks for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants