bazelbuild / bazelbuild/bazel

Inclusion checking problem on windows with gcc 13.1

Open
#18,379 1 comment 0 reactions 0 assignees View on GitHub
area-Windows help wanted P3 team-Rules-CPP type: bug
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 18h
Merged PRs (30d)
75

Description

### Description of the bug:

When building on windows with msys gcc13.1 and symlinking enabled, we're getting errors like
```
Compiling hl/src/H5DO.c failed: undeclared inclusion(s) in rule '@org_hdfgroup_hdf5//:hdf5_hl'
```

Digging in deeper, it seems that with gcc 12.2 or with `--nowindows_enable_symlinks`, the `.d` file contains lines like
```
external/org_hdfgroup_hdf5/hl/src/H5HLprivate2.h \
bazel-out/x64_windows-fastbuild/bin/external/org_hdfgroup_hdf5/_virtual_includes/hdf5/hdf5.h \
```
however with `--windows_enable_symlinks` we get
```
external/org_hdfgroup_hdf5/hl/src/H5HLprivate2.h \
C:/Users/azarchs/_bazel_azarchs/r6kacouw/external/org_hdfgroup_hdf5/src/hdf5.h \
```

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

I don't really have time to make a minimal reproducer on this but I encountered this with building
```starlark
http_archive(
name = "org_hdfgroup_hdf5",
strip_prefix = "hdf5-1.12.2",
urls = [
"https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.12/hdf5-1.12.2/src/hdf5-1.12.2.tar.gz",
"https://hdf-wordpress-1.s3.amazonaws.com/wp-content/uploads/manual/HDF5/HDF5_1_12_2/source/hdf5-1.12.2.tar.gz",
],
type = "tar.gz",
sha256 = "2a89af03d56ce7502dcae18232c241281ad1773561ec00c0f0e8ee2463910f14",
build_file = ":hdf5.BUILD",
)
```
building the `:hdf5_hl` target in this BUILD file
[hdf5.BUILD](https://github.com/bazelbuild/bazel/files/11456657/hdf5.txt)

Again, this happens with gcc 13.1 but not with gcc12.2.

### Which operating system are you running Bazel on?

Windows

### What is the output of `bazel info release`?

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

_No response_

### Have you found anything relevant by searching the web?

Yes, this seems likely related to or maybe

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

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the attached hdf5.BUILD file and reproduce the :hdf5_hl target on Windows using GCC 13.1, comparing --windows_enable_symlinks with --nowindows_enable_symlinks and GCC 12.2. Inspect the generated .d files and the inclusion-checking failure. Done means the GCC 13.1 symlink-enabled build no longer reports undeclared inclusions, with regression coverage for the differing paths.

Written by the indexing model from the issue text.

Assessment

Domain
build-system, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.