Absolute path inclusions found in rule
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 72
Description
### Description of the bug:
Whenever I try to build a protobuf cc library I get this error with some of the source protobuf files.
```
Starting local Bazel server and connecting to it...
INFO: Analyzed 3 targets (132 packages loaded, 4243 targets configured).
ERROR: C:/bazel-bin/external/protobuf~23.1/src/google/protobuf/BUILD.bazel:184:11: Compiling src/goo
gle/protobuf/port.cc [for tool] failed: absolute path inclusion(s) found in rule '@@protobuf~23.1//s
rc/google/protobuf:port_def':
the source file 'src/google/protobuf/port.cc' includes the following non-builtin files with absolute
paths (if these are builtin files, make sure these paths are in your toolchain):
'C:/bazel-bin/external/protobuf~23.1/src/google/protobuf/port_def.inc'
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 8.789s, Critical Path: 1.09s
INFO: 69 processes: 37 internal, 32 local.
ERROR: Build did NOT complete successfully
```
Repro: https://github.com/andrewkatson/protobuf_not_included
See: https://groups.google.com/g/protobuf/c/hwGG77sa1gA for more details
### 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.
Try building the top level of https://github.com/andrewkatson/protobuf_not_included
### Which operating system are you running Bazel on?
Windows 10
### What is the output of `bazel info release`?
release 7.0.0
### 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 HEAD` ?
```text
git@github.com:andrewkatson/protobuf_not_included.git
894cb6730a339a21ce5cf5d0cf3f41b400175978
```
### Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.
I can't go back that far because bzlmod didn't exist in bazel 4 when I last had this building.
### Have you found anything relevant by searching the web?
Not that I could find
### Any other information, logs, or outputs that you want to share?
_No response_
Contributor guide
Research direction
Start by reproducing the top-level build from the linked protobuf_not_included repository on Windows with Bazel 7.0.0. Inspect the reported external protobuf BUILD.bazel location around line 184 and the port.cc/port_def inclusion shown in the failure. Done means the reproduction builds without the absolute path inclusion error and the behavior is covered by an appropriate regression check.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100