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

Failed to load coverage: The file was not recognized as a valid object file - in WSL #316

Closed
robo9k opened this issue Sep 26, 2023 · 3 comments · Fixed by #317
Closed

Failed to load coverage: The file was not recognized as a valid object file - in WSL #316

robo9k opened this issue Sep 26, 2023 · 3 comments · Fixed by #317
Labels
C-bug Category: related to a bug. C-upstream-bug Category: This is a bug of compiler or dependencies (the fix may require action in the upstream)

Comments

@robo9k
Copy link

robo9k commented Sep 26, 2023

This seems to be the same as #48 , however cargo clean did not fix it.

$ git clone --branch v0.15.0 https://github.com/robo9k/rust-magic.git

$ cargo +stable --version
cargo 1.72.1 (103a7ff2e 2023-08-15)

$ cargo +stable install cargo-llvm-cov --locked
cargo-llvm-cov 0.5.32

$ cargo +stable llvm-cov --lcov --output-path lcov.info
[..]
error: failed to generate report: process didn't exit successfully: `/home/robo9k/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-cov export -format=lcov -instr-profile=/mnt/c/Users/robo9k/projects/rust-magic/target/llvm-cov-target/rust-magic.profdata -object target/llvm-cov-target/debug/deps/magic-85046b25feefe3f1 -object target/llvm-cov-target/debug/deps/magic-85046b25feefe3f1.d -ignore-filename-regex '/rustc/([0-9a-f]+|[0-9]+\.[0-9]+\.[0-9]+)/|^/mnt/c/Users/robo9k/projects/rust\-magic(/.*)?/(tests|examples|benches)/|^/mnt/c/Users/robo9k/projects/rust\-magic/target/llvm\-cov\-target($|/)|^/home/robo9k/\.cargo/(registry|git)/|^/home/robo9k/\.rustup/toolchains($|/)'` (exit status: 1)
--- stderr
error: Failed to load coverage: 'target/llvm-cov-target/debug/deps/magic-85046b25feefe3f1.d': The file was not recognized as a valid object file
error: Could not load coverage information

Running cargo clean results in the same error. Running with CARGO_INCREMENTAL=0 cargo +stable llvm-cov --lcov --output-path lcov.info results in the same error.

The error occurs is in Ubuntu in WSL with a Windows folder (/mnt/c/Users/robo9k/projects/rust-magic).
When running this in a Linux directory (e.g. mktemp -d) instead, the command works:

    Finished report saved to lcov.info

I'm not sure if this is even something you can reasonably fix in cargo-llvm-cov. Just thought I'd file an issue so others can find the information/workaround. Feel free to close this right away.

@taiki-e
Copy link
Owner

taiki-e commented Sep 26, 2023

Thanks for the report!

What is the permission of target/llvm-cov-target/debug/deps/magic-85046b25feefe3f1.d?

I guess that it is marked as executable for some reason.

@taiki-e taiki-e added the C-bug Category: related to a bug. label Sep 26, 2023
@taiki-e
Copy link
Owner

taiki-e commented Sep 26, 2023

Related: fitzgen/is_executable#12

@taiki-e taiki-e added the C-upstream-bug Category: This is a bug of compiler or dependencies (the fix may require action in the upstream) label Sep 26, 2023
@robo9k
Copy link
Author

robo9k commented Sep 26, 2023

$ stat target/llvm-cov-target/debug/deps/magic-85046b25feefe3f1.d
  File: target/llvm-cov-target/debug/deps/magic-85046b25feefe3f1.d
  Size: 262             Blocks: 0          IO Block: 4096   regular file
Device: 48h/72d Inode: 8444249301454017  Links: 1
Access: (0777/-rwxrwxrwx)  Uid: ( 1000/  robo9k)   Gid: ( 1000/  robo9k)
Access: 2023-09-26 16:58:19.921217100 +0200
Modify: 2023-09-26 16:58:19.921217100 +0200
Change: 2023-09-26 16:58:19.921217100 +0200
 Birth: -

The Windows file is indeed executable (chmod 0777).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: related to a bug. C-upstream-bug Category: This is a bug of compiler or dependencies (the fix may require action in the upstream)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants