Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sccache causes flowistry-driver to fail #18

Open
domenukk opened this issue Sep 29, 2021 · 4 comments
Open

sccache causes flowistry-driver to fail #18

domenukk opened this issue Sep 29, 2021 · 4 comments
Labels
analysis bug Something isn't working

Comments

@domenukk
Copy link

When trying to use flowistry for the first time, I get this error message:

Flowistry could not run because your project failed to build with error:
error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `sccache /Users/domenukk/.cargo/bin/flowistry-driver 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: "error: expected one of `!` or `[`, found keyword `if`\n --> /var/folders/9b/2lxhyc8567g980pxjn_t3qy40000gn/T/sccachewzZPue/testfile.c:1:2\n  |\n1 | #if defined(__NVCC__)\n  |  ^^ expected one of `!` or `[`\n\nerror: aborting due to previous error\n\n"

Could this be realted to sccache somehow? I'll try without next, but in any case it would be good to find another solution.

@willcrichton
Copy link
Owner

Thanks for the bug report @domenukk! It's almost certainly related to sccache. I've never tested with it. I'm not 100% sure if it it's even possible to integrate with sccache, because Flowistry uses a similar mechanism (RUSTC_WORKSPACE_WRAPPER) to integrate with rustc.

I noticed that Clippy also has an open issue on integrating with sccache: rust-lang/rust-clippy#3840

I'll play with this, but I wouldn't expect a fix unless Cargo gets patched to support this. Sorry!

@willcrichton willcrichton changed the title failed to run rustc to learn about target-specific information sccache causes flowistry-drier to fail Sep 29, 2021
@willcrichton willcrichton added analysis bug Something isn't working labels Sep 29, 2021
@willcrichton willcrichton changed the title sccache causes flowistry-drier to fail sccache causes flowistry-driver to fail Sep 29, 2021
@wangyingsm
Copy link

I encountered same problem.

@cauebs
Copy link

cauebs commented Mar 24, 2022

But isn't there a way to bypass sccache and call rustc directly? I'd like to use Flowistry without having to lose the setting that enables sccache system-wide.

@bjorn3
Copy link

bjorn3 commented May 22, 2022

Had the same problem with cg_clif: https://github.com/bjorn3/rustc_codegen_cranelift/issues/1091 The problem is indeed sccache. It detects whether it wraps rustc or a C compiler based on the executable name. This means that only "rustc" will be considered a rust compiler accepting the same arguments as rustc. If the executable is named anything different it will assume that is is gcc or clang and attempt to compile some C code using it to detect which C compiler is is exactly. I opened an issue about this a long time ago: mozilla/sccache#861 On cg_clif's side I worked around it by checking if RUSTC_WRAPPER is set to sccache and unsetting it if this is the case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analysis bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants