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

bazel coverage not working for 0.0.9 #219

Open
Ryang20718 opened this issue Jan 9, 2024 · 4 comments
Open

bazel coverage not working for 0.0.9 #219

Ryang20718 opened this issue Jan 9, 2024 · 4 comments
Labels
P3 Accepted issue. Team is likely to fix this issue in the future, but no short-term promises are made.

Comments

@Ryang20718
Copy link

Ryang20718 commented Jan 9, 2024

Description of the problem / feature request:

Bazel Coverage failing with rules_cc 0.0.9

Feature requests: what underlying problem are you trying to solve with this feature?

We're trying to uprev our rules_cc from ancient 0.0.1 to latest version as we prepare to migrate to bazel 7.0.0

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

test.cpp

#include <iostream>

int main() {
    std::cout << "Hello, World!" << std::endl;
    return 0;
}

BUILD

cc_library(
    name = "test_lib",
    srcs = ["test.cpp"],
)
cc_test(
    name = "test",
    srcs = [":test_lib"],
)

What operating system are you running Bazel on?

ubuntu 20.04

What's the output of bazel info release?

release 6.3.2

What version of rules_cc do you use? Can you paste the workspace rule used to fetch rules_cc? What other relevant dependencies does your project have?

0.0.9

What Bazel options do you use to trigger the issue? What C++ toolchain do you use?

I ran this with bazel 6.3.2 in the rules cc example section by adding the following section above. I'm using the cc toolchain configured by rules_cc.

System gcc is 9.0.0

Have you found anything relevant by searching the web?

https://groups.google.com/d/topic/bazel-discuss/dtduJBlb-nw (doesn't seem relevant)

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

bazelisk coverage //examples/my_c_archive/...


ERROR: /home/ryang/repos/rules_cc/examples/my_c_archive/BUILD:36:13: in my_c_compile rule //examples/my_c_archive:object: 
Traceback (most recent call last):
        File "/home/ryang/repos/rules_cc/examples/my_c_compile/my_c_compile.bzl", line 30, column 57, in _my_c_compile_impl
                feature_configuration = cc_common.configure_features(
Error in configure_features: Symbol profile is provided by all of the following features: coverage gcc_coverage_map_format
ERROR: /home/ryang/repos/rules_cc/examples/my_c_archive/BUILD:36:13: Analysis of target '//examples/my_c_archive:object' failed
ERROR: Analysis of target '//examples/my_c_archive:object' failed; build aborted: 
INFO: Elapsed time: 0.090s
@comius
Copy link
Collaborator

comius commented Feb 5, 2024

@c-mita for triage
possibly similar to bazelbuild/bazel#20993

@comius
Copy link
Collaborator

comius commented Feb 21, 2024

@c-mita friendly ping

@c-mita
Copy link
Member

c-mita commented Feb 21, 2024

I can't even build the example in this repo with Bazel 6.0.0 or later...

Regardless, I suspect the issue is here:

The "coverage" feature is a duplicate of the "gcc_coverage_map_format" one, but the latter "requires" the former and there's a conflict since they provide the same "profile" symbol.

@c-mita c-mita added the P3 Accepted issue. Team is likely to fix this issue in the future, but no short-term promises are made. label Feb 21, 2024
@andreas-0815-qwertz
Copy link

I got that issue too on Debian 12 with GCC 12. If you enable rool_cc toolchain coverage fails (because symbol profile is provided by several features. Using the built-in toolchains the issue is gone. To reproduce using the OP's code and BUILD file, use the following WORKSPACE.bazel.

workspace(name = "cov_issue")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

# ----------------- rules_cc -----------------------------------
http_archive(
    name = "rules_cc",
    urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.10-rc1/rules_cc-0.0.10-rc1.tar.gz"],
    sha256 = "d75a040c32954da0d308d3f2ea2ba735490f49b3a7aa3e4b40259ca4b814f825",
)

load("@rules_cc//cc:repositories.bzl", "rules_cc_dependencies", "rules_cc_toolchains")
# ----------------------------------------------------

rules_cc_dependencies()
rules_cc_toolchains()

Running bazel coverage --noenable_bzlmod --combined_report=lcov //:test produces the error. Commenting the last two lines in the workspace file and running the bazel command again, succeeds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 Accepted issue. Team is likely to fix this issue in the future, but no short-term promises are made.
Projects
None yet
Development

No branches or pull requests

4 participants