Skip to content

default GCOV_PREFIX_STRIP value incorrect on macOS #23719

Open
@oliverlee

Description

@oliverlee

Description of the bug:

When generating coverage on macOS and when using a gcc toolchain or an llvm toolchain configured to emit gcov, gcda files are not found unless GCOV_PREFIX_STRIP is set.

I'm able to set up the correct gcda path with GCOV_PREFIX_STRIP=10, although I don't know if that is specific to my laptop.

There are my .bazelrc settings for a hermetic LLVM toolchain:

coverage:gcov --experimental_generate_llvm_lcov=false
coverage:gcov --features=-coverage
coverage:gcov --copt=-coverage
coverage:gcov --linkopt=-coverage
coverage:gcov --test_env=GCOV_PREFIX_STRIP=10
coverage:gcov --test_env=COVERAGE_GCOV_PATH=./external/llvm18_toolchain_llvm/bin/llvm-cov

Can the documentation for this be improved in some way? And is it possible to use a better default value for macOS?

Which category does this issue belong to?

No response

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

No response

Which operating system are you running Bazel on?

No response

What is the output of bazel info release?

No response

If bazel info release returns development 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 HEAD ?

No response

If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.

No response

Have you found anything relevant by searching the web?

# TODO: GCOV_PREFIX_STRIP=3 is incorrect on MacOS in the default setup
export GCOV_PREFIX_STRIP=3

#19144

Any other information, logs, or outputs that you want to share?

No response

Metadata

Metadata

Assignees

Labels

P2We'll consider working on this in future. (Assignee optional)coverageteam-Rules-CPPIssues for C++ rulestype: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions