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

Compilation fails when using per-package-target and two packages have crates that share a dependency #12346

Closed
darklyspaced opened this issue Jul 11, 2023 · 1 comment
Labels
C-bug Category: bug S-triage Status: This issue is waiting on initial triage.

Comments

@darklyspaced
Copy link

darklyspaced commented Jul 11, 2023

Problem

In a workspace with two packages, with the two packages set to two different targets with the cargo per-package-target nightly feature, compilation fails (when invoked from workspace root) if the two separate packages depend on two crates that respectively share a dependency with one crate

However, compilation succeeds if compiling each of the packages separately (with --package or by cding into each dir and running cargo build there).

Steps

  1. Create a workspace with 2 separate crates
  2. Set them to two different targets, using forced-target or default-target -- one baremetal and one with std
  3. Add two crates to them, like uefi and clap respectively that both depend on the same crate. In this case, they both depend upon bitflags.
  4. Run cargo build from the workspace root. Compilation of bitflags should fail.

Here is a link to a cargo package the exhibits the problem: https://github.com/darklyspaced/ppt-bug

Possible Solution(s)

Root cause is probably that compilation targets are decided before the whole compile graph is known, leading to conflicts when two crates depend upon the same crate but under two different targets.

Notes

No response

Version

cargo 1.72.0-nightly (45782b6b8 2023-07-05)
release: 1.72.0-nightly
commit-hash: 45782b6b8afd1da042d45c2daeec9c0744f72cc7
commit-date: 2023-07-05
host: aarch64-apple-darwin
libgit2: 1.6.4 (sys:0.17.2 vendored)
libcurl: 7.88.1 (sys:0.4.63+curl-8.1.2 system ssl:(SecureTransport) LibreSSL/3.3.6)
ssl: OpenSSL 1.1.1u  30 May 2023
os: Mac OS 13.4.0 [64-bit]
@darklyspaced darklyspaced added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Jul 11, 2023
@darklyspaced
Copy link
Author

Going to close this as a side effect of issues already identified in the tracking issue for per-package-targets here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

1 participant