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

Missing dependency declaration with path mapping #23681

Closed
fmeum opened this issue Sep 19, 2024 · 4 comments
Closed

Missing dependency declaration with path mapping #23681

fmeum opened this issue Sep 19, 2024 · 4 comments
Assignees
Labels
P1 I'll work on this now. (Assignee required) team-Configurability platforms, toolchains, cquery, select(), config transitions team-Rules-CPP Issues for C++ rules type: bug

Comments

@fmeum
Copy link
Collaborator

fmeum commented Sep 19, 2024

I was testing this out with #23630 applied, I got pretty far but I hit this issue:

ERROR: AsyncRT/BUILD.bazel:138:23: Compiling AsyncRT/lib/Runtime/Globals/Globals.cpp failed: undeclared inclusion(s) in rule '//AsyncRT:RuntimeGlobals.static':
this rule is missing dependency declarations for the following files included by 'AsyncRT/lib/Runtime/Globals/Globals.cpp':
  'bazel-out/cfg/bin/external/gperftools/tcmalloc/include/gperftools/tcmalloc.h'

Where the header here is from a rules_foreign_cc target:

configure_make(
    name = "tcmalloc",
    autogen = True,
    configure_in_place = True,
    configure_options = [
        "--enable-shared=no",
    ],
    copts = [
        "-fPIC",
        "-w",
        "-fexceptions",  # Needed for tests, which ideally we wouldn't build
        "-Wno-register",
    ],
    lib_source = ":all_srcs",
    out_static_libs = ["libtcmalloc_minimal.a"],
    target_compatible_with = select({
        "@platforms//os:linux": [],
        "//conditions:default": ["@platforms//:incompatible"],
    }),
    visibility = ["//visibility:public"],
)

It might be relevant that I access it through an alias (although removing that doesn't help):

alias(
    name = "tcmalloc",
    actual = select({
        "@platforms//os:macos": "@gperftools-macos//:tcmalloc",
        "@platforms//os:linux": "@gperftools//:tcmalloc",
    }),
)

Are you tracking this one?

Originally posted by @keith in #22658 (comment)

@fmeum fmeum self-assigned this Sep 19, 2024
@fmeum fmeum added type: bug P1 I'll work on this now. (Assignee required) team-Configurability platforms, toolchains, cquery, select(), config transitions team-Rules-CPP Issues for C++ rules labels Sep 19, 2024
@fmeum
Copy link
Collaborator Author

fmeum commented Sep 19, 2024

@keith I added integration test coverage for headers from an external repo, but everything works there. Could you try to build a reproducer for me?

@keith
Copy link
Member

keith commented Sep 19, 2024

Here's a repro, I didn't try to isolate more than using this rules_foreign_cc target

repro.zip

@nikhilkalige
Copy link
Contributor

This may be of help #21718 (comment)

bazel-io pushed a commit to bazel-io/bazel that referenced this issue Sep 24, 2024
Fixes header inclusion errors with path mapping when including a header that is a non-direct child of a tree artifact.

Fixes bazelbuild#23681

Closes bazelbuild#23690.

PiperOrigin-RevId: 678118252
Change-Id: I37f4d5e8827785b291b5655967afba8f2a673df2
github-merge-queue bot pushed a commit that referenced this issue Sep 26, 2024
…discovery (#23745)

Fixes header inclusion errors with path mapping when including a header
that is a non-direct child of a tree artifact.

Fixes #23681

Closes #23690.

PiperOrigin-RevId: 678118252
Change-Id: I37f4d5e8827785b291b5655967afba8f2a673df2

Commit
9cfffdf

Co-authored-by: Fabian Meumertzheim <[email protected]>
@iancha1992
Copy link
Member

A fix for this issue has been included in Bazel 7.4.0 RC1. Please test out the release candidate and report any issues as soon as possible.
If you're using Bazelisk, you can point to the latest RC by setting USE_BAZEL_VERSION=7.4.0rc1. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 I'll work on this now. (Assignee required) team-Configurability platforms, toolchains, cquery, select(), config transitions team-Rules-CPP Issues for C++ rules type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants
@keith @nikhilkalige @fmeum @iancha1992 and others