cargo-auditable icon indicating copy to clipboard operation
cargo-auditable copied to clipboard

Fails when a rustc wrapper like sccache is set

Open amousset opened this issue 3 years ago • 4 comments

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"

amousset avatar Aug 03 '22 19:08 amousset

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.

amousset avatar Aug 03 '22 19:08 amousset

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.

Shnatsel avatar Aug 03 '22 21:08 Shnatsel

I'll try to make a proper fix for sccache.

amousset avatar Aug 03 '22 23:08 amousset

I've reported the issue to sccache: https://github.com/mozilla/sccache/issues/1274

Shnatsel avatar Aug 10 '22 17:08 Shnatsel

A PR fixing this in sccache is up: https://github.com/mozilla/sccache/pull/1280

Shnatsel avatar Sep 06 '22 12:09 Shnatsel

This is fixed in sccache git master; closing.

Shnatsel avatar Sep 18 '22 23:09 Shnatsel

The fix has shipped in sccache v0.3.1.

Shnatsel avatar Dec 01 '22 02:12 Shnatsel