-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Wrong include path to Clang 16 on Windows #17863
Copy link
Copy link
Closed
Labels
P3We're not considering working on this, but happy to review a PR. (No assignee)We're not considering working on this, but happy to review a PR. (No assignee)team-Rules-CPPIssues for C++ rulesIssues for C++ rulestype: bug
Description
Description of the bug:
Building C++ with Clang 16.0.0 and Bazel 6 on Windows spits out "missing dependency declarations" for include files:
ERROR: .../BUILD:10:10: Compiling main.cpp failed: undeclared inclusion(s) in rule '//:main':
this rule is missing dependency declarations for the following files included by 'main.cpp':
'C:/Program Files/LLVM/lib/clang/16/include/vadefs.h'
The clang lib is installed in C:/Program Files/LLVM/lib/clang/16, but Bazel uses clang-cl -v to detect the version used in the path, which is 16.0.0 here, hence wrongfully using the C:/Program Files/LLVM/lib/clang/16.0.0 path.
In external/local_config_cc/BUILD:
cc_toolchain_config(
name = "clang_cl_x64",
cpu = "x64_windows",
compiler = "clang-cl",
# ...
msvc_env_include = "...;C:\\Program Files\\LLVM\\lib\\clang\\16.0.0\\include",
msvc_env_lib = "...;C:\\Program Files\\LLVM\\lib\\clang\\16.0.0\\lib\\windows",
# ...
cxx_builtin_include_directories = [
# ...
"C:\\Program Files\\LLVM\\lib\\clang\\16.0.0\\include"],
# ...
)
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Use the following C++ file
#include <stdio.h>
int main()
{
printf("Hello, world! " __clang_version__ "\n");
return 0;
}
With the Bazel config described in https://bazel.build/configure/windows#clang with --incompatible_enable_cc_toolchain_resolution.
Which operating system are you running Bazel on?
Windows 10
What is the output of bazel info release?
release 6.1.1
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?
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P3We're not considering working on this, but happy to review a PR. (No assignee)We're not considering working on this, but happy to review a PR. (No assignee)team-Rules-CPPIssues for C++ rulesIssues for C++ rulestype: bug