Repository navigation
[cmake] Drop CMake's cached DEPFILE list after generating a dictionary - #23876
Merged
Merged
Conversation
The Makefile generators of CMake < 4.0 merge the entries of a custom command's DEPFILE into CMakeFiles/<target>.dir/compiler_depend.internal instead of replacing them (CMake issue 26399 [1], fixed in 4.0 only). Every file rootcling ever recorded therefore stays a prerequisite of the dictionary for the life of the build tree. Once one of them disappears, e.g. because a CI job restores a master build tree and then checks out a PR whose base predates a header or LinkDef that master had added, the stale entry becomes an empty rule for a missing file, which make treats as always updated: the dictionary is regenerated on every build. That is what the "Check for spurious rebuilds" CI step has been reporting for test/Tetris on every Linux job with CMake 3.x since Oct 24: Tetris loads Gui.pcm, Gui had just gained ASImageUtils and ROOTPadPainter in master, and the PR trees did not have those LinkDefs yet. Dictionaries that are OBJECT libraries only escaped because CMake re-ran in the same build, which wipes their cache; without a re-run they regenerate forever as well. Remove the cached list right after rootcling has written the fresh depfile, which is what CMake itself does for library targets whenever it regenerates. The next dependency scan then starts from the depfile alone. Only done for Makefile generators with CMake < 4.0, where the problem exists; Ninja and CMake 4 are unaffected. [1] https://gitlab.kitware.com/cmake/cmake/-/work_items/26399 🤖 Done with the help of AI
Test Results 24 files 24 suites 3d 22h 55m 6s ⏱️ Results for commit 79c3077. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Makefile generators of CMake < 4.0 merge the entries of a custom command's DEPFILE into CMakeFiles/.dir/compiler_depend.internal instead of replacing them (CMake issue 26399 [1], fixed in 4.0 only). Every file rootcling ever recorded therefore stays a prerequisite of the dictionary for the life of the build tree. Once one of them disappears, e.g. because a CI job restores a master build tree and then checks out a PR whose base predates a header or LinkDef that master had added, the stale entry becomes an empty rule for a missing file, which make treats as always updated: the dictionary is regenerated on every build.
That is what the "Check for spurious rebuilds" CI step has been reporting for test/Tetris on every Linux job with CMake 3.x since Oct 24: Tetris loads Gui.pcm, Gui had just gained ASImageUtils and ROOTPadPainter in master, and the PR trees did not have those LinkDefs yet. Dictionaries that are OBJECT libraries only escaped because CMake re-ran in the same build, which wipes their cache; without a re-run they regenerate forever as well.
Remove the cached list right after rootcling has written the fresh depfile, which is what CMake itself does for library targets whenever it regenerates. The next dependency scan then starts from the depfile alone. Only done for Makefile generators with CMake < 4.0, where the problem exists; Ninja and CMake 4 are unaffected.
[1] https://gitlab.kitware.com/cmake/cmake/-/work_items/26399
🤖 Done with the help of AI
Should fix CI failures like in #23840