bazel: cc_libaray target won't be rebuilt when header files are modified
Description of the bug:
cc_libaray target won’t be rebuilt when header files list in hdrs
attr are modified.
Which category does this issue belong to?
C++/Objective-C Rules
What’s the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Create a target with a c++ header file and a c++ source file:
cc_library(
name = "my_lib",
hdrs = ["my_lib.hpp"],
)
cc_binary(
name = "main",
srcs = ["main.cpp"],
deps = ["my_lib"]
)
my_lib.hpp
content:
#include <string>
struct MyLib {
std::string value = "my_lib";
};
main.cpp
content:
#include <iostream>
#include "my_lib.hpp"
int main(){
MyLib obj;
std::cout << obj.value << std::endl;
return 0;
}
Run bazel run my_lib
. and modify my_lib.hpp
to set default value of MyLib::value
to another string (do not modify the main.cpp
), run bazel run my_lib
again. We will get a same output as
the target will not be rebuilt.
Which operating system are you running Bazel on?
Windows
What is the output of bazel info release
?
6.3.2
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
Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.
No response
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
Note that I test all release version from 6.1.1 to 6.3.2, This bug exists in version 6.2.0 and later versions, but 6.1.1 ~ 6.1.2 works well.
About this issue
- Original URL
- State: closed
- Created 10 months ago
- Comments: 18 (11 by maintainers)
Commits related to this issue
- Only use `/showIncludes` if supported The auto-configured Windows toolchain now only enables `/showIncludes` if the English language pack for VS is installed and the compiler language can thus be for... — committed to bazel-io/bazel by fmeum 10 months ago
- [6.4.0] Only use `/showIncludes` if supported (#19521) The auto-configured Windows toolchain now only enables `/showIncludes` if the English language pack for VS is installed and the compiler langu... — committed to bazelbuild/bazel by bazel-io 10 months ago
- Error on potential unsupported `/showIncludes` lines This error ensures that removing the English language pack for MSVC without also refetching `@local_config_cc` doesn't result in silently incorrec... — committed to bazelbuild/bazel by fmeum 9 months ago
- Error on potential unsupported `/showIncludes` lines This error ensures that removing the English language pack for MSVC without also refetching `@local_config_cc` doesn't result in silently incorrec... — committed to bazel-io/bazel by fmeum 9 months ago
- [6.4.0] Error on potential unsupported `/showIncludes` lines (#19611) This error ensures that removing the English language pack for MSVC without also refetching `@local_config_cc` doesn't result in... — committed to bazelbuild/bazel by bazel-io 9 months ago
My omission, after run
bazel clean --expunge
, warning message prints correctly.No, it will silently fall back to an available locale. I am working on a fix.
No, According to https://github.com/bazelbuild/bazel/discussions/19451, I solved the problem temporarily by installing English language package in VS and adding the environment variable
VSLANG
.@bazel-io fork 6.4.0
@bazel-io flag