Skip to content

-Zbindeps panics with activated_features for invalid package: features did not find PackageId #10431

New issue

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

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

Already on GitHub? # to your account

Closed
Jasper-Bekkers opened this issue Feb 27, 2022 · 3 comments · Fixed by #10433
Labels
C-bug Category: bug Z-bindeps Nightly: binary artifact dependencies

Comments

@Jasper-Bekkers
Copy link

Problem

thread 'main' panicked at 'activated_features for invalid package: features did not find PackageId { name: "jni", version: "0.19.0", source: "registry `crates-io`" } NormalOrDevOrArtifactTarget(Some(CompileTarget { name: "aarch64-linux-android" }))', src\tools\cargo\src/cargo\core\resolver\features.rs:318:14

Attached is a small copy of the project, it's a copy of the android-ndk-rs hello world sample that I'm trying to adapt to use bindeps to see if I can have them create an apk.

android-test.zip

Steps

  1. Download attached zip file
  2. Build with cargo +nightly build -Zbindeps, or a clean cargo from main (5be1b1b5b)

Possible Solution(s)

No response

Notes

No response

Version

No response

@Jasper-Bekkers Jasper-Bekkers added the C-bug Category: bug label Feb 27, 2022
@Jasper-Bekkers Jasper-Bekkers changed the title bindep panics with activated_features for invalid package: features did not find PackageId -Zbindeps panics with activated_features for invalid package: features did not find PackageId Feb 27, 2022
@ehuss ehuss added the Z-bindeps Nightly: binary artifact dependencies label Feb 27, 2022
@ehuss
Copy link
Contributor

ehuss commented Feb 27, 2022

Thanks!

@Byron I think the issue is these lines. I believe those should be looking at FeaturesFor. In this example, android isn't in requested_targets.

@Jasper-Bekkers
Copy link
Author

Thanks for taking a look @ehuss !

@Byron
Copy link
Member

Byron commented Feb 28, 2022

Thanks @Jasper-Bekkers for the files, I will try to reproduce it today, thanks @ehuss for narrowing it down, that will help with the fix.
I will submit it as new PR when ready.

Byron added a commit to Byron/cargo that referenced this issue Feb 28, 2022
bors added a commit that referenced this issue Mar 16, 2022
Fix panic when artifact target is used for `[target.'cfg(<target>)'.dependencies`

With an artifact dependency like this in package `a`…

```toml
[dependencies.a]
path = "b"
artifact = "bin"
target = "$TARGET"
```

…and when using `$TARGET` like this in another package `b`…

```toml
[target.'cfg(target_arch = "$ARCHOF_$TARGET")'.dependencies]
c = { path = "../c" }
```

…it panics with `thread 'main' panicked at 'activated_features for invalid package: features did not find PackageId <dbg-info>`, but we would expect this to work normally.

### Tasks

- [x] reproduce issue in new test
   - [x] figure out why the test is fixed but the real-world example isn't
- [x] find a fix

Fixes #10431 and  #10452.
@bors bors closed this as completed in 1190f5f Mar 16, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-bug Category: bug Z-bindeps Nightly: binary artifact dependencies
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants