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

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

Open
tamird opened this issue Dec 27, 2024 · 3 comments · May be fixed by #134850
Open
Labels
C-bug Category: This is a bug. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. regression-untriaged Untriaged performance or correctness regression.

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

@tamird tamird linked a pull request Dec 28, 2024 that will close this issue
@apiraino apiraino removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Dec 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. regression-untriaged Untriaged performance or correctness regression.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants