Skip to content

error: cannot satisfy dependencies so ... only shows up once when linking rustc_driver since #122362 #134825

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
tamird opened this issue Dec 27, 2024 · 3 comments · Fixed by #134850
Labels
C-discussion Category: Discussion or questions that doesn't represent real issues. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@tamird
Copy link
Contributor

tamird commented Dec 27, 2024

Code

I tried this code:

src/lib.rs:

#![feature(rustc_private)]

extern crate rustc_driver;
extern crate rustc_session;

#[rustversion::since(2024-11-03)]
use rustc_session::config::host_tuple as rustc_host;

#[rustversion::before(2024-11-03)]
use rustc_session::config::host_triple as rustc_host;

pub fn host() -> &'static str {
    rustc_host()
}

tests/integration_test.rs:

#[test]
fn test_target_tuple() {
    assert_ne!(
        testing_integration_rustc_private::host(),
        "unknown-unknown-unknown"
    );
}

I expected to see this happen: cargo +nightly test succeeds.

Instead, this happened:

$ cargo +nightly test

   Compiling testing-integration-rustc-private v0.1.0 (/Users/tamird/src/testing-integration-rustc-private)
error: cannot satisfy dependencies so `rustc_driver` only shows up once
  |
  = help: having upstream crates all available in one format will likely make this go away
  = note: `rustc_driver` was unavailable as a static crate, preventing fully static linking
  = help: `feature(rustc_private)` is needed to link to the compiler's `rustc_driver` library

error: cannot satisfy dependencies so `core` only shows up once
  |
  = help: having upstream crates all available in one format will likely make this go away
  = help: `feature(rustc_private)` is needed to link to the compiler's `rustc_driver` library

error: cannot satisfy dependencies so `compiler_builtins` only shows up once
  |
  = help: having upstream crates all available in one format will likely make this go away
  = help: `feature(rustc_private)` is needed to link to the compiler's `rustc_driver` library

error: cannot satisfy dependencies so `rustc_std_workspace_core` only shows up once
  |
  = help: having upstream crates all available in one format will likely make this go away
  = help: `feature(rustc_private)` is needed to link to the compiler's `rustc_driver` library

error: cannot satisfy dependencies so `alloc` only shows up once
  |
  = help: having upstream crates all available in one format will likely make this go away
  = help: `feature(rustc_private)` is needed to link to the compiler's `rustc_driver` library

error: cannot satisfy dependencies so `libc` only shows up once
  |
  = help: having upstream crates all available in one format will likely make this go away
  = help: `feature(rustc_private)` is needed to link to the compiler's `rustc_driver` library

error: cannot satisfy dependencies so `unwind` only shows up once
  |
  = help: having upstream crates all available in one format will likely make this go away
  = help: `feature(rustc_private)` is needed to link to the compiler's `rustc_driver` library

error: cannot satisfy dependencies so `cfg_if` only shows up once
  |
  = help: having upstream crates all available in one format will likely make this go away
  = help: `feature(rustc_private)` is needed to link to the compiler's `rustc_driver` library

error: cannot satisfy dependencies so `miniz_oxide` only shows up once
  |
  = help: having upstream crates all available in one format will likely make this go away
  = help: `feature(rustc_private)` is needed to link to the compiler's `rustc_driver` library

error: cannot satisfy dependencies so `adler` only shows up once
  |
  = help: having upstream crates all available in one format will likely make this go away
  = help: `feature(rustc_private)` is needed to link to the compiler's `rustc_driver` library

error: cannot satisfy dependencies so `hashbrown` only shows up once
  |
  = help: having upstream crates all available in one format will likely make this go away
  = help: `feature(rustc_private)` is needed to link to the compiler's `rustc_driver` library

error: cannot satisfy dependencies so `rustc_std_workspace_alloc` only shows up once
  |
  = help: having upstream crates all available in one format will likely make this go away
  = help: `feature(rustc_private)` is needed to link to the compiler's `rustc_driver` library

error: cannot satisfy dependencies so `std_detect` only shows up once
  |
  = help: having upstream crates all available in one format will likely make this go away
  = help: `feature(rustc_private)` is needed to link to the compiler's `rustc_driver` library

error: cannot satisfy dependencies so `rustc_demangle` only shows up once
  |
  = help: having upstream crates all available in one format will likely make this go away
  = help: `feature(rustc_private)` is needed to link to the compiler's `rustc_driver` library

error: cannot satisfy dependencies so `addr2line` only shows up once
  |
  = help: having upstream crates all available in one format will likely make this go away
  = help: `feature(rustc_private)` is needed to link to the compiler's `rustc_driver` library

error: cannot satisfy dependencies so `gimli` only shows up once
  |
  = help: having upstream crates all available in one format will likely make this go away
  = help: `feature(rustc_private)` is needed to link to the compiler's `rustc_driver` library

error: cannot satisfy dependencies so `object` only shows up once
  |
  = help: having upstream crates all available in one format will likely make this go away
  = help: `feature(rustc_private)` is needed to link to the compiler's `rustc_driver` library

error: cannot satisfy dependencies so `memchr` only shows up once
  |
  = help: having upstream crates all available in one format will likely make this go away
  = help: `feature(rustc_private)` is needed to link to the compiler's `rustc_driver` library

error: cannot satisfy dependencies so `panic_unwind` only shows up once
  |
  = help: having upstream crates all available in one format will likely make this go away
  = help: `feature(rustc_private)` is needed to link to the compiler's `rustc_driver` library

error: could not compile `testing-integration-rustc-private` (test "integration_test") due to 19 previous errors

Version it worked on

Using cargo-rustc-bisect:

searched nightlies: from nightly-2024-08-05 to nightly-2024-12-27                                                                                                         
regressed nightly: nightly-2024-08-12                                                                                                                                     
searched commit range: https://github.com/rust-lang/rust/compare/730d5d4095a264ef5f7c0a0781eea68c15431d45...41dd149fd6a6a06795fc6b9f54cb49af2f61775f
regressed commit: https://github.com/rust-lang/rust/commit/9cb1998ea15e179482504e07cad8fa121e169a32

This points to #122362 (9cb1998).

@tamird tamird added C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. labels Dec 27, 2024
@rustbot rustbot added I-prioritize Issue: Indicates that prioritization has been requested for this issue. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Dec 27, 2024
@tamird tamird changed the title error: cannot satisfy dependencies so \...\ only shows up once when linking rustc_driver since #122362 error: cannot satisfy dependencies so ... only shows up once when linking rustc_driver since #122362 Dec 27, 2024
@bjorn3
Copy link
Member

bjorn3 commented Dec 28, 2024

You need to add #![feature(rustc_private)] to the test crate too. The presence of the feature gate changes the way the linkage format for dylibs is calculated in a way that is necessary for linking against dylibs that statically link libstd.

@tamird
Copy link
Contributor Author

tamird commented Dec 28, 2024

Nice, that does fix it. Seems like we should update the unstable book. Should I send a PR?

@bjorn3
Copy link
Member

bjorn3 commented Dec 28, 2024

Sure

@apiraino apiraino removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Dec 28, 2024
@jieyouxu jieyouxu added C-discussion Category: Discussion or questions that doesn't represent real issues. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. and removed C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Dec 28, 2024
@bors bors closed this as completed in 8060f58 Dec 29, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Dec 29, 2024
Rollup merge of rust-lang#134850 - tamird:rustc-private-book-update, r=bjorn3

Document virality of `feature(rustc_private)`

Closes rust-lang#134825.

r? `@bjorn3`
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-discussion Category: Discussion or questions that doesn't represent real issues. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants