Description of the bug:
We use include_prefix in our C++ assets for legacy component laytout. This has stopped working in bazel 6.0.0, although the virtual includes directory is produced.
If you use include_prefix = "x" and #include "x/blah.h" it works.
If you use includes = ["."] and #include "blah.h" it works.
If you use include_prefix = "" and #include "blah.h" it fails.
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
diff --git a/.bazelversion b/.bazelversion
new file mode 100644
index 0000000..73fcd45
--- /dev/null
+++ b/.bazelversion
@@ -0,0 +1 @@
+6.0.0rc5
\ No newline at end of file
diff --git a/BUILD b/BUILD
new file mode 100644
index 0000000..ff015f9
--- /dev/null
+++ b/BUILD
@@ -0,0 +1,5 @@
+cc_test(
+ name="test",
+ srcs = ["test.cpp"],
+ deps = ["//blah"],
+)
\ No newline at end of file
diff --git a/WORKSPACE b/WORKSPACE
new file mode 100644
index 0000000..e69de29
diff --git a/blah/BUILD b/blah/BUILD
new file mode 100644
index 0000000..08a2dd6
--- /dev/null
+++ b/blah/BUILD
@@ -0,0 +1,6 @@
+cc_library(
+ name = "blah",
+ hdrs = ["blah.h"],
+ include_prefix = "",
+ visibility = ["//:__pkg__"],
+)
diff --git a/blah/blah.h b/blah/blah.h
new file mode 100644
index 0000000..e69de29
diff --git a/test.cpp b/test.cpp
new file mode 100644
index 0000000..6dc850a
--- /dev/null
+++ b/test.cpp
@@ -0,0 +1,5 @@
+#include "blah.h"
+
+int main(){
+ return 0;
+}
\ No newline at end of file
Which operating system are you running Bazel on?
windows
What is the output of bazel info release?
release 6.0.0rc5
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?
No response
Any other information, logs, or outputs that you want to share?
Bazel 6.0.0 output fails...
ERROR: C:/dev/test/BUILD:1:8: Compiling test.cpp failed: (Exit 2): cl.exe failed: error executing command (from target //:test)
cd /d C:/dev/_bazel/l2habeez/execroot/__main__
SET INCLUDE=C:\bazeltools\vs16\VC\Tools\MSVC\14.29.30133\ATLMFC\include;C:\bazeltools\vs16\VC\Tools\MSVC\14.29.30133\include;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um;C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\shared;C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\um;C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\winrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\cppwinrt
SET PATH=C:\bazeltools\vs16\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64;C:\bazeltools\vs16\Common7\IDE\VC\VCPackages;C:\bazeltools\vs16\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\bazeltools\vs16\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer;C:\bazeltools\vs16\MSBuild\Current\bin\Roslyn;C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64\;C:\bazeltools\vs16\Common7\Tools\devinit;C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x64;C:\Program Files (x86)\Windows Kits\10\bin\x64;C:\bazeltools\vs16\\MSBuild\Current\Bin;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\bazeltools\vs16\Common7\IDE\;C:\bazeltools\vs16\Common7\Tools\;;C:\Windows\system32
SET PWD=/proc/self/cwd
SET RUNFILES_MANIFEST_ONLY=1
SET TEMP=C:\Users\JAMESC~1\AppData\Local\Temp
SET TMP=C:\Users\JAMESC~1\AppData\Local\Temp
C:\bazeltools\vs16\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\cl.exe /nologo /DCOMPILER_MSVC /DNOMINMAX /D_WIN32_WINNT=0x0601 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /bigobj /Zm500 /EHsc /wd4351 /wd4291 /wd4250 /wd4996 /I. /Ibazel-out/x64_windows-fastbuild/bin /Iexternal/bazel_tools /Ibazel-out/x64_windows-fastbuild/bin/external/bazel_tools /DBAZEL_CURRENT_REPOSITORY="" /showIncludes /MD /Od /Z7 /wd4117 -D__DATE__="redacted" -D__TIMESTAMP__="redacted" -D__TIME__="redacted" /Fobazel-out/x64_windows-fastbuild/bin/_objs/test/test.obj /c test.cpp
# Configuration: b67f5ac3d5b94ed15e96cb37e833e7120042529b3e382867f55890fe82af9163
# Execution platform: @local_config_platform//:host
test.cpp(1): fatal error C1083: Cannot open include file: 'blah.h': No such file or directory
INFO: Elapsed time: 1.060s, Critical Path: 0.14s
INFO: 2 processes: 2 internal.
FAILED: Build did NOT complete successfully
Working with Bazel 5.3.2
PS C:\dev\test> bazel build ... -s
Starting local Bazel server and connecting to it...
INFO: Invocation ID: 1a9c33cb-a9f5-4155-8b4b-d7a3931a6f13
INFO: Analyzed 2 targets (48 packages loaded, 681 targets configured).
INFO: Found 2 targets...
SUBCOMMAND: # //:test [action 'Compiling test.cpp', configuration: 8fcc02caf7268a43edcd2a5a3e8e4edfa3c614a84823ca1599fcd30251ebce9f, execution platform: @local_config_platform//:host]
cd /d C:/dev/_bazel/l2habeez/execroot/__main__
SET INCLUDE=C:\bazeltools\vs16\VC\Tools\MSVC\14.29.30133\ATLMFC\include;C:\bazeltools\vs16\VC\Tools\MSVC\14.29.30133\include;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um;C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\shared;C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\um;C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\winrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\cppwinrt
SET PATH=C:\bazeltools\vs16\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64;C:\bazeltools\vs16\Common7\IDE\VC\VCPackages;C:\bazeltools\vs16\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\bazeltools\vs16\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer;C:\bazeltools\vs16\MSBuild\Current\bin\Roslyn;C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64\;C:\bazeltools\vs16\Common7\Tools\devinit;C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x64;C:\Program Files (x86)\Windows Kits\10\bin\x64;C:\bazeltools\vs16\\MSBuild\Current\Bin;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\bazeltools\vs16\Common7\IDE\;C:\bazeltools\vs16\Common7\Tools\;;C:\Windows\system32
SET PWD=/proc/self/cwd
SET RUNFILES_MANIFEST_ONLY=1
SET TEMP=C:\Users\JAMESC~1\AppData\Local\Temp
SET TMP=C:\Users\JAMESC~1\AppData\Local\Temp
C:\bazeltools\vs16\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\cl.exe /nologo /DCOMPILER_MSVC /DNOMINMAX /D_WIN32_WINNT=0x0601 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /bigobj /Zm500 /EHsc /wd4351 /wd4291 /wd4250 /wd4996 /I. /Ibazel-out/x64_windows-fastbuild/bin /Iexternal/bazel_tools /Ibazel-out/x64_windows-fastbuild/bin/external/bazel_tools /Ibazel-out/x64_windows-fastbuild/bin/blah/_virtual_includes/blah /showIncludes /MD /Od /Z7 /wd4117 -D__DATE__="redacted" -D__TIMESTAMP__="redacted" -D__TIME__="redacted" /Fobazel-out/x64_windows-fastbuild/bin/_objs/test/test.obj /c test.cpp
# Configuration: 8fcc02caf7268a43edcd2a5a3e8e4edfa3c614a84823ca1599fcd30251ebce9f
# Execution platform: @local_config_platform//:host
INFO: Elapsed time: 15.772s, Critical Path: 0.11s
INFO: 2 processes: 1 disk cache hit, 1 internal.
INFO: Build completed successfully, 2 total actions
Virtual includes are created, but don't seem to work.
PS C:\dev\test> dir .\bazel-bin\ -r | select -exp fullname
C:\dev\test\bazel-bin\blah
C:\dev\test\bazel-bin\test.exe.runfiles
C:\dev\test\bazel-bin\_objs
C:\dev\test\bazel-bin\test.exe
C:\dev\test\bazel-bin\test.exe-2.params
C:\dev\test\bazel-bin\test.exe.runfiles_manifest
C:\dev\test\bazel-bin\test.pdb
C:\dev\test\bazel-bin\blah\_virtual_includes
C:\dev\test\bazel-bin\blah\_virtual_includes\blah
C:\dev\test\bazel-bin\blah\_virtual_includes\blah\blah.h
C:\dev\test\bazel-bin\test.exe.runfiles\MANIFEST
C:\dev\test\bazel-bin\_objs\test
Description of the bug:
We use
include_prefixin our C++ assets for legacy component laytout. This has stopped working in bazel 6.0.0, although the virtual includes directory is produced.If you use
include_prefix = "x"and#include "x/blah.h"it works.If you use
includes = ["."]and#include "blah.h"it works.If you use
include_prefix = ""and#include "blah.h"it fails.What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Which operating system are you running Bazel on?
windows
What is the output of
bazel info release?release 6.0.0rc5
If
bazel info releasereturnsdevelopment versionor(@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?
No response
Any other information, logs, or outputs that you want to share?
Bazel 6.0.0 output fails...
Working with Bazel 5.3.2
Virtual includes are created, but don't seem to work.