Skip to content

inclusion validation fails when dot-d files have absolute paths for transitive #includes #14346

@amberdixon

Description

@amberdixon

Description of the problem / feature request:

In some cases, clang outputs absolute paths to the dot-d files for objective-c source files. The bazel5 code that detects inclusion problems with Objective-C source files fails.

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

One of my objective-c libraries has source files whose corresponding .d files contain absolute paths.

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

  1. Clone and check out the rules_ios WIP PR here: Repro problem with absolute paths in dot-d files breaking inclusion validation in bazel5 bazel-ios/rules_ios#366
  2. Run bazel build -s //tests/ios/InclusionProblemRepro:LibraryA_objc

Expected result: build succeeds
Actual: Build fails with the error message: ERROR: /Users/amberdixon/Development/rules_ios/tests/ios/InclusionProblemRepro/BUILD.bazel:3:14: Compiling tests/ios/InclusionProblemRepro/Classes/Extensions/D.m failed: undeclared inclusion(s) in rule '//tests/ios/InclusionProblemRepro:LibraryA_objc': this rule is missing dependency declarations for the following files included by 'tests/ios/InclusionProblemRepro/Classes/Extensions/D.m': '/private/var/tmp/_bazel_amberdixon/bee3f665d317c886aa3a5be8caf5517a/sandbox/darwin-sandbox/12/execroot/build_bazel_rules_ios/tests/ios/InclusionProblemRepro/Classes/HeaderB.h' Target //tests/ios/InclusionProblemRepro:LibraryA_objc failed to build

Also note that the .d file for this source has an absolute path:

~/Development/rules_ios amber/repro-inclusion-issue-bazel5 tail -2  bazel-out/applebin_macos-darwin_x86_64-dbg-ST-45eefeec3d2c/bin/tests/ios/InclusionProblemRepro/_objs/LibraryA_objc/arc/D.d 
  tests/ios/InclusionProblemRepro/Classes/HeaderC.h \
  /private/var/tmp/_bazel_amberdixon/bee3f665d317c886aa3a5be8caf5517a/sandbox/darwin-sandbox/12/execroot/build_bazel_rules_ios/tests/ios/InclusionProblemRepro/Classes/HeaderB.h

What operating system are you running Bazel on?

MacOS 11.6.1

What's the output of bazel info release?

development version

If bazel info release returns "development version" or "(@Non-Git)", tell us how you built Bazel.

Cherry-pick this commit (d966a0d) onto the 5.0.0-pre.20211011.2 bazel pre-release and rebuild bazel.

What's the output of git remote get-url origin ; git rev-parse master ; git rev-parse HEAD ?

~/Development/bazel (15a1b19085...) git remote get-url origin ; git rev-parse master ; git rev-parse HEAD
[email protected]:bazelbuild/bazel.git
9108f9b
15a1b19085ee7c423a20d98590f980abf35a5805

Have you found anything relevant by searching the web?

No

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

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions