Fails when a rustc wrapper like sccache is set
Having a rustc wrapper defined (like build caching with RUSTC_WRAPPER=sccache) makes build fail:
$ export RUSTC_WRAPPER=sccache
$ cargo auditable build --release
error: failed to run `rustc` to learn about target-specific information
Caused by:
process didn't exit successfully: `/home/amousset/.cargo/bin/sccache /home/amousset/.cargo/bin/cargo-auditable rustc - --crate-name ___ --print=file-names --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (exit status: 2)
--- stderr
sccache: error: failed to execute compile
sccache: caused by: Compiler not supported: "Unrecognized command: \"-E\"\n"
This is because RUSTC_WORKSPACE_WRAPPER doesn't work well with sccache. clippy has run into the same problem, finally fixed by adding a special case to handle it in sccache.
Yeah, looks like sccache compiler detection just doesn't work with RUSTC_WORKSPACE_WRAPPER. It fails to realize that we're invoking rustc, and complains about an unsupported compiler. Looks like it will need to be fixed in sccache.
I don't want to add ourselves as another special case. A more robust approach to this would be looking at the second argument as well, not just the first one, to determine the kind of the executable. This can be done either unconditionally, or only if RUSTC_WORKSPACE_WRAPPER is set and matches the name of the executable.
I'd be grateful if someone could take care of the issue report and/or PR to sccache - I'll be rather pressed for time until the weekend.
I'll try to make a proper fix for sccache.
I've reported the issue to sccache: https://github.com/mozilla/sccache/issues/1274
A PR fixing this in sccache is up: https://github.com/mozilla/sccache/pull/1280
This is fixed in sccache git master; closing.
The fix has shipped in sccache v0.3.1.