Skip to content

cc_library doesn't collect debug_context(s) from implementation_deps #19146

@anhlinh123

Description

@anhlinh123

Description of the bug:

Currently, cc_library only merges debug_context(s) from deps and forward them to its dependents.
Consequently, cc_binary can't generate a dwp file containing sufficient debug info.

Which category does this issue belong to?

C++ Rules

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

cc_library(
name = "lib",
implementation_deps = ["impl_dep1, impl_dep2"],
)

# the file ":bin.dwp" doesn't have all the debug info from "impl_dep1", "impl_dep2"
cc_binary(
name = "bin",
deps = ["lib"],
)

Which operating system are you running Bazel on?

Ubuntu

What is the output of bazel info release?

release 6.1.1

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 master; git rev-parse HEAD ?

No response

Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.

No response

Have you found anything relevant by searching the web?

No response

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

I believe this line https://github.com/bazelbuild/bazel/blob/master/src/main/starlark/builtins_bzl/common/cc/cc_library.bzl#L309C123-L309C123
should be changed to:
debug_context = cc_helper.merge_cc_debug_contexts(compilation_outputs, cc_helper.get_providers(ctx.attr.deps + ctx.attr.implementation_deps, CcInfo))

Metadata

Metadata

Labels

P2We'll consider working on this in future. (Assignee optional)team-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