cargo-auditable: Incompatibility with sccache on long builds
When using cargo auditable with sccache, cargo auditable sometimes panics. We’re seeing that panic on long (5> mins) builds:
sccache: error: failed to execute compile
sccache: caused by: Compiler not supported: "thread \'main\' panicked at \'called `Result::unwrap()` on an `Err` value: MissingOption(Keys([\"--crate-name\", \"\"]))\', cargo-auditable/src/rustc_wrapper.rs:13:50\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n"
Running under strace shows that sccache is running /path/to/cargo-auditable rustc -vV when compiling a workspace member. Normally sccache runs this when compiling a dependency, and caches the information. On larger builds that cache expires causing sccache to run that command when compiling a workspace member, causing the panic
The panic can trivially by reproduced with
CARGO_PRIMARY_PACKAGE=foo ~/.cargo/bin/cargo-auditable rustc -vV
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: MissingOption(Keys(["--crate-name", ""]))', cargo-auditable/src/rustc_wrapper.rs:13:50
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
or by creating a new project without any dependencies and building with sccache and cargo auditable:
tom [ ~ ]$ cargo init new
Created binary (application) package
tom [ ~ ]$ cd new
tom [ ~/new ]$ RUSTC_WRAPPER=/home/tom/.cargo/bin/sccache cargo auditable build
Compiling new v0.1.0 (/home/tom/new)
sccache: error: failed to execute compile
sccache: caused by: Compiler not supported: "thread \'main\' panicked at \'called `Result::unwrap()` on an `Err` value: MissingOption(Keys([\"--crate-name\", \"\"]))\', cargo-auditable/src/rustc_wrapper.rs:13:50\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n"
error: could not compile `new`
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 28 (17 by maintainers)
Ah, the
sccache-less workaround is to use a shared target directory for all your projects: https://doc.rust-lang.org/nightly/cargo/reference/config.html#buildtarget-dirIt’s getting late in my timezone, so I’ll investigate the log and try to reproduce tomorrow. Thank you!
Thanks! I’m afraid it didn’t follow forks, you’ll need a more advanced command:
strace --follow-forks --trace=%process --columns=200That should follow subprocesses and capture only the relevant syscalls.
Thanks for all the help in debugging this, by the way!