sccache: Compiler not supported: "error: Unrecognized option: \'E\'\n\n"
Just upgraded to Rust 1.52.0 and get this:
sccache: error: failed to execute compile
sccache: caused by: Compiler not supported: "error: Unrecognized option: \'E\'\n\n"
error: could not compile `xxx`
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 12
- Comments: 20 (7 by maintainers)
I ran into this issue, and in my case the problem was that I had installed sccache with
cargo binstallwhich by default creates a symlink to the actual sccache binary.I reinstalled without the symlink with
cargo binstall --no-symlinks -y sccacheand everything worked fine. It’s a bit weird, sccache probably shouldn’t fail if its symlinked, so that’s another problem.PS: I’m using this as part of some GitHub actions I recently created because I didn’t like the existing ones:
https://github.com/brndnmtthws/rust-action https://github.com/brndnmtthws/rust-action-rustup https://github.com/brndnmtthws/rust-action-cargo-binstall
Perhaps other people will get some value out of these.
@drahnr I don’t seem to be able to actually trigger this with a simple use-case. I’ve encountered this issue on some internal codebase that uses the latest Rust via
rustup.When I’ll get the chance I’ll try to trigger it once more and see if I can reduce it to a simpler scenario.
I’ve also stumbled upon this issue. (In my case I only had
RUSTC_WRAPPER=sccacheexported, and no other hardlinks tosccache.)However, I’ve managed to implement a small proof-of-concept
sccachewrapper (yes, a wrapper to the wrapper) that is able to correctly handle all these situations:RUSTC_WRAPPER=sccacheandrustccallsccor another compiler; (basically it ignores the doublesccache sccache ccinvocation;)cc,gcc,rustc, etc. somewhere in the path; (i.e. it switches tosccache cc😉 (this perhaps covers #993)sccache.txt
One can just download it, change the extension,
chmod +xand then start symlink-ing it tosccache,cc,c++,gcc,g++,clang,clang++andrustcsomewhere in a folder that is at the front of the$PATH.Then one can just use it transparently. (If one doesn’t use
rustup, but instead uses therustcandcargothat comes with the distribution, it can even work without exportingRUSTC_WRAPPER.)After a little investigation, this is because Rust is trying to call
sccache cc main.c, and since the symlink was setup, when the command gets tosccacheit has becomesccache sccache main.c, something thatsccachedoesn’t seem to accept.