rust-lang / cargo

The Rust package manager
https://doc.rust-lang.org/cargo
Apache License 2.0
12.66k stars 2.41k forks source link

'cargo install' ignores build rustc-wrapper specified in $HOME/.cargo/config #8852

Closed PeterGrace closed 3 years ago

PeterGrace commented 3 years ago

Problem When running cargo install, it is found that cargo is not compiling with rustc-wrapper, causing the install process to ignore my sccache deployment.

Steps

  1. Configure $HOME/.cargo/config to contain a [build]\nrustc-wrapper="/path/to/sccache"
  2. Run cargo -v install and see that rustc command is not wrapped.
  3. Clone repository source and run cargo -v build and notice that rustc command is properly wrapped.

Notes

app@9541d5f35d70:~$ cat $HOME/.cargo/config
[build]
rustc-wrapper="/usr/bin/sccache"

app@9541d5f35d70:~$ cargo -v install cargo-tarpaulin
    Updating crates.io index
  Installing cargo-tarpaulin v0.17.0
   Compiling libc v0.2.80
   Compiling autocfg v1.0.1
     Running `rustc --crate-name build_script_build /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.80/build.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debug-assertions=off --cfg 'feature="align"' --cfg 'feature="default"' --cfg 'feature="extra_traits"' --cfg 'feature="std"' -C metadata=82079956ac67971a -C extra-filename=-82079956ac67971a --out-dir /tmp/cargo-installw8rFFt/release/build/libc-82079956ac67971a -L dependency=/tmp/cargo-installw8rFFt/release/deps --cap-lints allow`
app@9541d5f35d70:~$ cd src/tarpaulin/
app@9541d5f35d70:~/src/tarpaulin$ cargo -v build
<..snip..>
   Compiling quick-xml v0.20.0
   Compiling nix v0.19.0
     Running `/usr/bin/sccache rustc --crate-name quick_xml /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/quick-xml-0.20.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="default"' -C metadata=14e33f583741b667 -C extra-filename=-14e33f583741b667 --out-dir /home/app/src/tarpaulin/target/debug/deps -L dependency=/home/app/src/tarpaulin/target/debug/deps --extern memchr=/home/app/src/tarpaulin/target/debug/deps/libmemchr-b9c9c711d3caf825.rmeta --cap-lints allow`

Output of cargo version:

app@9541d5f35d70:~$ cargo version
cargo 1.49.0-nightly (becb4c282 2020-10-28)
ehuss commented 3 years ago

Hm, I'm unable to reproduce or think of a way this could happen. Do you have any CARGO_* environment variables set? Maybe try running with CARGO_LOG=trace environment variable and see if it displays any clues (unfortunately it does not display much about config files).

PeterGrace commented 3 years ago

I am closing this as I don't have the ability to reproduce this anymore. It was probably a localized issue if no one else can repro.