-
Notifications
You must be signed in to change notification settings - Fork 4.4k
cc_libaray target won't be rebuilt when header files are modified #19439
Copy link
Copy link
Closed
Labels
Description
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.
Reactions are currently unavailable