Skip to content

[Bug]: zlib: headers should not be copied into a separate folder #9767

Description

@carlosgalvezp

What happened?

For zlib, there's some workaround which involves copying headers into a different location:
https://github.com/bazelbuild/bazel-central-registry/blob/main/modules/zlib/1.3.2/overlay/BUILD.bazel#L68

This is a problem for DWYU (depend on what you use), because the same headers but in different locations are added to both srcs and hdrs.

The comment does not really explain what kind of "damage" it's talking about. Using includes = ["."] is perfectly fine, it will translate to -isystem external/zlib/ which is exactly what we want. Otherwise it's not even needed nowadays, if one enables the external_include_paths feature, which automatically uses -isystem for external headers.

Therefore, this workaround should be removed and the library should simply have its headers in the hdrs attribute.

Version

Development (host) and target OS/architectures: Ubuntu 24.04 x86_64

Output of bazel --version: 8.7.0

Version of relevant rules from the WORKSPACE or MODULE.bazel file:

Language(s) and/or frameworks involved:

How to reproduce

Any other information?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions