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

Dependencies that should not be built in the target arch are still built #8940

Closed
xxuejie opened this issue Dec 4, 2020 · 3 comments
Closed
Labels
C-bug Category: bug

Comments

@xxuejie
Copy link

xxuejie commented Dec 4, 2020

Problem

https://github.com/xxuejie/cargo-target-dep-test This is a minimal repo reproducing the problem. As denoted here, the included dependency should not be built in riscv64 targets, yet it is still built.

Steps

  1. git clone https://github.com/xxuejie/cargo-target-dep-test
  2. cd cargo-target-dep-test
  3. rustup target add riscv64imac-unknown-none-elf
  4. cargo build --target riscv64imac-unknown-none-elf

This would result an error. Even though ckb-x64-simulator is marked as a dependency only in non-riscv64 envnvironment, it is still built here.

When those lines are commented out, the crate could be built just fine.

Possible Solution(s)

Target specific dependency should be handled propoerly.

Notes

Output of cargo version:
cargo 1.48.0 (65cbdd2 2020-10-14)

@xxuejie xxuejie added the C-bug Category: bug label Dec 4, 2020
@ehuss
Copy link
Contributor

ehuss commented Dec 4, 2020

Features for dependencies are unified, even if they are for targets that are not currently enabled. This means that the features of the molecule package that ckb-x64-simulator enables causes it to add optional dependencies that are not compatible with no_std.

You can work around this with -Zfeatures=itarget. The tracking issue for that is #7914.

@xxuejie
Copy link
Author

xxuejie commented Dec 4, 2020

That seems to be the reason for this problem, many thanks.

@ehuss
Copy link
Contributor

ehuss commented Jan 7, 2021

Closing as a duplicate of #7914, and note it has now been stabilized.

@ehuss ehuss closed this as completed Jan 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants