mozilla / sccache

Sccache is a ccache-like tool. It is used as a compiler wrapper and avoids compilation when possible. Sccache has the capability to utilize caching in remote storage environments, including various cloud storage options, or alternatively, in local storage.
Apache License 2.0
5.85k stars 552 forks source link

sccache and cargo conditional build dependencies? #496

Open asajeffrey opened 5 years ago

asajeffrey commented 5 years ago

Over in Servo, we've been having intermittent build issues which go away if we disable sccache: https://github.com/servo/servo/issues/23428.

The problem appears to be that there's a conditional build dependency on one of our crates:

[target.'cfg(target_os = "macos")'.build-dependencies]
cc = "1.0"

but if we run with sccache on MacOS, we get:

     Running `sccache rustc --edition=2018 --crate-name build_script_build ports/glutin/build.rs --color never --crate-type bin --emit=dep-info,link -C debuginfo=2 --cfg 'feature="default"' --cfg 'feature="default-except-unstable"' --cfg 'feature="libservo"' --cfg 'feature="log"' --cfg 'feature="max_log_level"' --cfg 'feature="native-bluetooth"' --cfg 'feature="unstable"' --cfg 'feature="webdriver"' -C metadata=44edc4fbc2c5ec67 -C extra-filename=-44edc4fbc2c5ec67 --out-dir /Users/worker/tasks/task_1558299510/repo/target/debug/build/servo-44edc4fbc2c5ec67 -L dependency=/Users/worker/tasks/task_1558299510/repo/target/debug/deps -Dwarnings -W unused-extern-crates`
error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead?
 --> ports/glutin/build.rs:6:1
  |
6 | extern crate cc;
  | ^^^^^^^^^^^^^^^^
  |
  = note: for more information, see https://github.com/rust-lang/rust/issues/27812
  = help: add #![feature(rustc_private)] to the crate attributes to enable

Note that the rustc command line doesn't include

    --extern cc=...rlib

so for some reason it looks like cargo / scache isn't passing a conditional build dependency?

chmanchester commented 5 years ago

That makes it look like the issue is somewhere between the build machine and cargo. The command line quoted there is the invocation of sccache itself -- I don't think there would be anything interesting happening between cargo and sccache before that point.

asajeffrey commented 5 years ago

Hmm, could be that this is a cargo issue. Sigh, software has so many moving parts!