Open Antiarchitect opened 3 years ago
Are you, by any chance, using CC=ccache
or similar? See https://github.com/paritytech/sccache/issues/69 for a similar error
I am seeing the same error and I don't install ccache
. Is it in the official No, it is not.rust
Docker images?
Could you try rerunning this with SCCACHE_LOG=trace
and/or RUST_LOG=sccache=trace
(depending on whether you use sccache
or sccache-dist
, see https://github.com/mozilla/sccache/pull/977) to see which exact command fails? Do you have a custom CC
or CXX
set?
Here's a full build log.
Relevant output:
Is this a normal build or are you attempting to use cargo clippy ?
Ah, it is cargo clippy
. Thought I had seen that mentioned here, but I guess not. To that end there are these issues:
Maybe a cargo clippy
too.
sccache: error: failed to execute compile
sccache: caused by: Compiler not supported: "error: Unrecognized option: \'E\'\n\n"
error: could not compile `xxx`
rustc 1.52.1 (9bc8c42bb 2021-05-09)
clippy 0.1.52 (9bc8c42 2021-05-09)
sccache 0.2.15
Linux xxx 5.12.10-arch1-1 #1 SMP PREEMPT Thu, 10 Jun 2021 16:34:50 +0000 x86_64 GNU/Linux
Started seeing this as well, are there any workarounds at least?
I get the same error when building sccache
with RUSTC_WRAPPER=/usr/local/bin/sccache
and export PATH="/usr/local/libexec/sccache:$PATH
. Basically, when you're trying to let sccache
to cache both the Rust compilations and the C compilations invoked by Rust (i.e. I have a hard link to sccache
called cc
), it will panic and get angry at you.
Build command: cargo build --release
on macOS Monterey 12.3.1 with M1 chip, no Rosetta.
CC version: Apple clang version 13.1.6 (clang-1316.0.21.2.3)
Compiling tokio v1.16.1
error: failed to run custom build command for `ring v0.16.20`
Caused by:
process didn't exit successfully: `/Users/**/sccache/target/release/build/ring-045d3048ac3b0efb/build-script-build` (exit status: 101)
--- stdout
OPT_LEVEL = Some("3")
TARGET = Some("aarch64-apple-darwin")
HOST = Some("aarch64-apple-darwin")
CC_aarch64-apple-darwin = None
CC_aarch64_apple_darwin = None
HOST_CC = None
CC = None
CFLAGS_aarch64-apple-darwin = None
CFLAGS_aarch64_apple_darwin = None
HOST_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("false")
CARGO_CFG_TARGET_FEATURE = None
--- stderr
running "/usr/local/bin/sccache" "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-arch" "arm64" "-I" "include" "-Wall" "-Wextra" "-pedantic" "-pedantic-errors" "-Wall" "-Wextra" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-fno-strict-aliasing" "-fvisibility=hidden" "-fstack-protector" "-gfull" "-DNDEBUG" "-c" "-o/Users/**/sccache/target/aarch64-apple-darwin/release/build/ring-48dc3c11b24f9950/out/aesv8-armx-ios64.o" "/Users/**/.cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.20/pregenerated/aesv8-armx-ios64.S"
sccache: error: failed to execute compile
sccache: caused by: Compiler not supported: "error: Found argument \'-E\' which wasn\'t expected, or isn\'t valid in this context\n\nUSAGE:\n cc [FLAGS] [OPTIONS] [cmd]...\n\nFor more information try --help\n"
thread 'main' panicked at 'execution failed', /Users/**/.cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.20/build.rs:656:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
The following warnings were emitted during compilation:
warning: sccache: error: failed to execute compile
warning: sccache: caused by: Compiler not supported: "error: Found argument \'-E\' which wasn\'t expected, or isn\'t valid in this context\n\nUSAGE:\n cc [FLAGS] [OPTIONS] [cmd]...\n\nFor more information try --help\n"
warning: sccache: error: failed to execute compile
warning: sccache: caused by: Compiler not supported: "error: Found argument \'-E\' which wasn\'t expected, or isn\'t valid in this context\n\nUSAGE:\n cc [FLAGS] [OPTIONS] [cmd]...\n\nFor more information try --help\n"
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 to sccache
it has become sccache sccache main.c
, something that sccache
doesn't seem to accept.
Are there any updates on this? @GZGavinZhao can you find a solution to use sccache
for both rust and C/C++ compilations?
I think the underlying problem is that My local testing shows that this is not the case, might be something else...RUSTC_WRAPPER
should be ignored when Rust is trying to compile C code.
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 tosccache
it has becomesccache sccache main.c
, something thatsccache
doesn't seem to accept.
I've also stumbled upon this issue. (In my case I only had RUSTC_WRAPPER=sccache
exported, and no other hardlinks to sccache
.)
However, I've managed to implement a small proof-of-concept sccache
wrapper (yes, a wrapper to the wrapper) that is able to correctly handle all these situations:
RUSTC_WRAPPER=sccache
and rustc
calls cc
or another compiler; (basically it ignores the double sccache sccache cc
invocation;)cc
, gcc
, rustc
, etc. somewhere in the path; (i.e. it switches to sccache cc
;) (this perhaps covers #993)One can just download it, change the extension, chmod +x
and then start symlink-ing it to sccache
, cc
, c++
, gcc
, g++
, clang
, clang++
and rustc
somewhere 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 the rustc
and cargo
that comes with the distribution, it can even work without exporting RUSTC_WRAPPER
.)
@cipriancraciun is there a minimal reproducible test case one could look at?
@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.
Just installed sccache
and I'm getting this same error:
➜ sccache cargo build
sccache: error: failed to execute compile
sccache: caused by: Compiler not supported: "error: unexpected argument \'-E\' found\n\nUsage: cargo [+toolchain] [OPTIONS] [COMMAND]\n\nFor more information, try \'--help\'.\n"
These are the versions I'm currently using:
sccache 0.3.3
cargo 1.70.0-nightly (9880b408a 2023-02-28)
rustup 1.25.2 (17db695f1 2023-02-01)
rustc 1.70.0-nightly (f15f0ea73 2023-03-04)
I'm trying to build this: https://github.com/mrmarble/rust-playground
At first I'd install sccache via cargo-binstall
which produces the same output for any command (i.e, sccache --version
outputs the same error), installing sccache with cargo install
seems to work better as I can use the other commands, but it still fails to compile rust
I ran into this issue, and in my case the problem was that I had installed sccache with cargo binstall
which by default creates a symlink to the actual sccache binary.
I reinstalled without the symlink with cargo binstall --no-symlinks -y sccache
and 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.
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 tosccache
it has becomesccache sccache main.c
, something thatsccache
doesn't seem to accept.I've also stumbled upon this issue. (In my case I only had
RUSTC_WRAPPER=sccache
exported, and no other hardlinks tosccache
.)However, I've managed to implement a small proof-of-concept
sccache
wrapper (yes, a wrapper to the wrapper) that is able to correctly handle all these situations:
- works if
RUSTC_WRAPPER=sccache
andrustc
callscc
or another compiler; (basically it ignores the doublesccache sccache cc
invocation;)- works if this wrapper is symlinked to
cc
,gcc
,rustc
, etc. somewhere in the path; (i.e. it switches tosccache cc
;) (this perhaps covers Symbolic link doesn't seem to work on Linux #993)- the above two combined;
One can just download it, change the extension,
chmod +x
and then start symlink-ing it tosccache
,cc
,c++
,gcc
,g++
,clang
,clang++
andrustc
somewhere 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 therustc
andcargo
that comes with the distribution, it can even work without exportingRUSTC_WRAPPER
.)
just tried this and its no longer working, which directory was this file supposed to go in?
However, I've managed to implement a small proof-of-concept
sccache
wrapper (yes, a wrapper to the wrapper) that is able to correctly handle all these situations: [...]just tried this and its no longer working, which directory was this file supposed to go in?
@MustCodeAl the way I've implemented it you can put my wrapper script anywhere on the file-system, as long as that folder is at the beginning of the PATH
variable, or at least before the actual place where sccache
and the other gcc
/ cc
/ rustc
/ etc. are. (I.e. you can't place it in the same folder where these tools are.)
You can also then symlink this script as cc
, gcc
, etc. (see the source code for what it knows to intercept).
However, could you say how it does not work? Does it give some errors? (Perhaps set a set -x
somewhere at the beginning and paste the resulting execution trace.)
Just upgraded to Rust 1.52.0 and get this: