Open UlrichEckhardt opened 2 years ago
@c-mita can you triage?
Hi @UlrichEckhardt, I encountered this issue when I was setting up a hermetic gcc toolchain. I managed to resolve it by,
filegroup(
name = "coverage_files",
srcs = [
"@repo1//:gcov_wrapper_script",
"@repo2//:gcov",
],
)
filegroup(
name = "gcc_all_files",
srcs = [
":some_files",
":gcc_coverage_files",
],
)
all_files = ":gcc_all_files",
. So in your case
cc_toolchain(
name = "my_cc_toolchain",
all_files = ":gcc_all_files",
toolchain_config = ":my_cc_toolchain_config",
)
Hopefully this helps!
This was failing for me as well. Fixed it by installing llvm-cov
since the script seems to find that executable.
Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 90 days unless any other activity occurs. If you think this issue is still relevant and should stay open, please post any comment here and the issue will no longer be marked as stale.
The tool_path accepts either toolchain relative paths or absolute paths, so it's pretty hard to reference gcov binary from external dep. Workaround seems to be using COVERAGE_GCOV_PATH
env variable, like: --test_env=COVERAGE_GCOV_PATH=external/my-gcc/bin/gcov
but it stopped working in bazel 7.2: https://github.com/bazelbuild/bazel/issues/23247. The bug metions also some possible solutions, including using action_configs instead of tool_paths, which seems to be right approach here.
Description of the bug:
The handling of tool paths in C++ toolchains is inconsistent, it works as expected for tools like
gcc
,ld
andar
, but not forgcov
. In the end,gcov
is not found and no coverage is generated. The error you find in the test.log file isNote here the duplication of
toolchains/mingw
in the path.What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
I haven't fully extracted a minimal reproducible example yet, but here is the rough layout of it:
toolchain/cc_toolchain_config.bzl
toolchain/gcc.sh
toolchain/gcov.sh
toolchain/BUILD
Which operating system are you running Bazel on?
Ubuntu
What is the output of
bazel info release
?release 5.1.1
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse master; git rev-parse HEAD
?No response
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
gcov
. For all others tools, there are actions (compile, link etc) and action_configs that reference the tools, but not forgcov
. That also means I can't define e.g. aPATH
to that tool in order to help Bazel find it.7746 is related to my actual goal, to run a
gcov
from an archive.