Open KKhanhH opened 4 months ago
The docs at https://learn.microsoft.com/en-us/cpp/build/reference/external-external-headers-diagnostics?view=msvc-170 do sound like the flag replaces /I
. Do you have a reproducer you can share?
I can't seem to get a minimum reproducer, so here's the repo I was having issues with, when bazel files were added to it. From what I could tell, the only difference in the subcommand was the change in the flag, and the build fails due to not being able to find uv.h even though its include folder was in the "includes" of libuv.
well, I guess the issue is because /external:I depends on /external:Wn first, and since adding the feature doesn't add that, it will skip the /external:I flag and not resolve the include. So, this bug isn't actually because /external:I doesn't replace /I, but because the subcommand doesn't include /external:W.
I've tried adding --cxxopt=/external:W0 but it seems to have no effect.
Realized the issue, forgot that --cxxopt doesn't apply to C libraries. After fixing some issues with the build file it compiles. However there still are warnings coming from external libraries and system libraries.
Description of the bug:
Enabling the feature external_include_paths changes the directories specified by the "includes" attribute of cc_library from using /I flag to using /external:I flag. This will mark the include directories as external, but since it removes the /I flag, MSVC will not be able to resolve the includes.
Solution should be to just keep /I flag along with /external:I
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.
Create a bazel project that requires the "includes" tag in cc_library, add a "#include" that won't resolve when the includes attribute is missing. MSVC will report that the include cannot be found when external_include_paths is enabled.
Which operating system are you running Bazel on?
Windows 10
What is the output of
bazel info release
?6.4.0 (bug is also present on 7.2.0)
If
bazel info release
returnsdevelopment 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
?No response
If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.
No response
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
Sub command without external_include_paths enabled
With external_include_paths enabled