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

Ubuntu via WSL on Windows 10: Fatal error: No such file or directory #1067

Open
tobyhede opened this issue Nov 14, 2021 · 4 comments
Open

Ubuntu via WSL on Windows 10: Fatal error: No such file or directory #1067

tobyhede opened this issue Nov 14, 2021 · 4 comments

Comments

@tobyhede
Copy link

Seeing this error on Ubuntu via WSL on Windows 10.

Found other threads that suggested restarting the sccache server, but no luck.
Another run will product an error on a different crate. (eg ring will fail and the next run ct-logs will fail. The underlying error is the same.

sccache: encountered fatal error
sccache: error: No such file or directory (os error 2)
sccache: caused by: No such file or directory (os error 2)
error: could not compile `ring`

Caused by:
  process didn't exit successfully: `/home/user/.cargo/bin/sccache rustc --crate-name ring --edition=2018 /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/ring-0.16.20/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="alloc"' --cfg 'feature="default"' --cfg 'feature="dev_urandom_fallback"' --cfg 'feature="once_cell"' -C metadata=7cf15f2b22f7f6b7 -C extra-filename=-7cf15f2b22f7f6b7 --out-dir /mnt/c/Users/user/Clone/roapi/target/debug/deps -C linker=/usr/bin/clang -L dependency=/mnt/c/Users/user/Clone/roapi/target/debug/deps --extern libc=/mnt/c/Users/user/Clone/roapi/target/debug/deps/liblibc-309e066b556daa10.rmeta --extern once_cell=/mnt/c/Users/user/Clone/roapi/target/debug/deps/libonce_cell-97a1520c7459742f.rmeta --extern spin=/mnt/c/Users/user/Clone/roapi/target/debug/deps/libspin-c648a9bc5fe6b97b.rmeta --extern untrusted=/mnt/c/Users/user/Clone/roapi/target/debug/deps/libuntrusted-9743e30f23533517.rmeta --cap-lints allow -Clink-arg=-fuse-ld=lld -Zshare-generics=y -L native=/mnt/c/Users/user/Clone/roapi/target/debug/build/ring-936718e64e5e54ca/out -l static=ring-core -l static=ring-test` (exit status: 254)
warning: build failed, waiting for other jobs to finish...
error: build failed
@sylvestre sylvestre changed the title Fatal error: No such file or directory Ubuntu via WSL on Windows 10: Fatal error: No such file or directory Nov 14, 2021
@luser
Copy link
Contributor

luser commented Nov 15, 2021

Is the sccache binary you're using a Linux binary? It's unfortunate that whatever code is hitting this error isn't attaching the filename to the error message. You can try enabling debug logging to see if the logs provide more useful context.

@tobyhede
Copy link
Author

@luser Yeah, installed into linux running on WSL. Will try debug logging.

@tobyhede
Copy link
Author

Debug logging doesn't seem to reveal much more about the source of the error.

In this case the error occured with the bitflags crate.
Log lines containing bitflags:

[2021-11-19T01:03:01Z DEBUG sccache::server] parse_arguments: Ok: ["--crate-name", "bitflags", "/home/userhede/.cargo/registry/src/github.com-1ecc6299db9ec823/bitflags-1.2.1/src/lib.rs", "--error-format=json", "--json=diagnostic-rendered-ansi,artifacts", "--crate-type", "lib", "--emit=dep-info,metadata,link", "-C", "embed-bitcode=no", "-C", "debuginfo=2", "--cfg", "feature=\"default\"", "-C", "metadata=40a8e069acc5120e", "-C", "extra-filename=-40a8e069acc5120e", "--out-dir", "/mnt/c/Users/user/Clone/roapi/target/debug/deps", "-L", "dependency=/mnt/c/Users/user/Clone/roapi/target/debug/deps", "--cap-lints", "allow", "-Clink-arg=-fuse-ld=lld", "-Zshare-generics=y", "--cfg", "bitflags_const_fn"]
[2021-11-19T01:03:01Z DEBUG sccache::compiler::compiler] [bitflags]: get_cached_or_compile: ["--crate-name", "bitflags", "/home/userhede/.cargo/registry/src/github.com-1ecc6299db9ec823/bitflags-1.2.1/src/lib.rs", "--error-format=json", "--json=diagnostic-rendered-ansi,artifacts", "--crate-type", "lib", "--emit=dep-info,metadata,link", "-C", "embed-bitcode=no", "-C", "debuginfo=2", "--cfg", "feature=\"default\"", "-C", "metadata=40a8e069acc5120e", "-C", "extra-filename=-40a8e069acc5120e", "--out-dir", "/mnt/c/Users/user/Clone/roapi/target/debug/deps", "-L", "dependency=/mnt/c/Users/user/Clone/roapi/target/debug/deps", "--cap-lints", "allow", "-Clink-arg=-fuse-ld=lld", "-Zshare-generics=y", "--cfg", "bitflags_const_fn"]

[2021-11-19T01:03:02Z DEBUG sccache::compiler::compiler] [bitflags]: generate_hash_key took 0.387 s

[2021-11-19T01:03:02Z DEBUG sccache::compiler::compiler] [bitflags]: Cache hit in 0.001 s

[2021-11-19T01:03:02Z ERROR sccache::server] ["bitflags"] fatal error: No such file or directory (os error 2)
[2021-11-19T01:03:02Z ERROR sccache::server] ["bitflags"] 	No such file or directory (os error 2)

sccache was installed via cargo, btw.

@luser
Copy link
Contributor

luser commented Nov 22, 2021

It does provide more information! The log shows that sccache got a cache hit, so the error must be while trying to extract the outputs from the cache entry. sccache's cache entries are zip files containing the stdout/stderr of the cached process execution, along with the set of output files from the compilation. This error is almost assuredly originating in the CacheRead::extract_objects function, which is responsible for doing that work:

sccache/src/cache/cache.rs

Lines 152 to 179 in 50d0b1f

pub async fn extract_objects<T>(
mut self,
objects: T,
pool: &tokio::runtime::Handle,
) -> Result<()>
where
T: IntoIterator<Item = (String, PathBuf)> + Send + Sync + 'static,
{
pool.spawn_blocking(move || {
for (key, path) in objects {
let dir = match path.parent() {
Some(d) => d,
None => bail!("Output file without a parent directory!"),
};
// Write the cache entry to a tempfile and then atomically
// move it to its final location so that other rustc invocations
// happening in parallel don't see a partially-written file.
let mut tmp = NamedTempFile::new_in(dir)?;
let mode = self.get_object(&key, &mut tmp)?;
tmp.persist(&path)?;
if let Some(mode) = mode {
set_file_mode(&path, mode)?;
}
}
Ok(())
})
.await?
}

There are 4 function calls there using ? to propogate errors that don't add additional context to returned errors, so any of those could result in this confusingly vague error message.

That function gets called here, FWIW:

match entry.extract_objects(outputs.clone(), &pool).await {

You can see the "Cache hit" message is logged right above that call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants