-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add back cmake command-line cache on unix #86764
Conversation
Besides the interrupted build, there was another case that was making this caching painful for me. That was when I was adding or modifying certain feature detection in configure.cmake stuff. Such changes require the cmake to be rerun, so the caching was preventing these changes from having any effect and I had to manually delete the artifacts/obj directory each time I've made a change into that file. Actually, editing anything in the cmake files has no effect unless you delete the artifacts/obj if the caching is added. That might be unexpected to people when they update their local state from github without cleaning the artifacts folder. |
@janvorli thanks for sharing your thoughts. My goal is to have a mode where incremental builds don't re-run configure, to match the typical cmake flow of running configure when you change the build definitions, then only running the build in the inner loop. The few seconds are significant in relation to the ~5s goal mentioned in #47022. We could do this by requiring an opt-in to get the fast innerloop build via Another option is to split configure out into a separate step that must be run explicitly before build - but I don't think runtime devs will have an appetite for this. So the next best option seems to make the default experience use a cache, and have an opt-out as you suggested. We have a |
This is saving a second for one use-case and adding 15 minutes penalty for others where there is no way but to delete the You can save time by deduplicating and deleting unused / unnecessary introspection checks. Plenty to clean up on the real side of things.. |
I agree as well that the default build should be safe, and if somebody wants a shortcut build which is faster but can sometime fail, then there should be some kind of option to do that. |
After thinking about it a bit more, I feel more strongly now that the default should be to not to use the cache. We can add a command line option to enable the caching for the cases where we care about the extra second or two. |
Tagging subscribers to this area: @dotnet/runtime-infrastructure Issue DetailsThis was deleted in #64370 because a canceled configure would leave around the cache file, causing subsequent invocations to start building with the incomplete configure. I'm adding it back along with a fix to write the cache file after configure, as suggested in #64370 (comment). I made the same fix to the windows logic. This saves 1-2s during incremental builds on my machine. Contributes to #47022.
|
I experimented a bit, and it looks like cmake has logic to re-run configure during the build (make or ninja) if it detects changes to the cmake files. For example if I introduce a fatal error into some cmake file, even with the caching, it re-configures and fails the build. Does that address these concerns, or are there scenarios where it's still a problem? If so I'd like to understand the issue better. |
@sbomer I have thought that your change was skipping cmake completely when the command line was detected to be unchanged. That would prevent the cmake logic you've mentioned from kicking in and that's exactly the concern I had. Am I missing something then? |
The generated makefiles/ninja files check the cmake files for updates. It can pick up changes to the files themselves, but not environment changes, etc. |
I think that re-running cmake configure also doesn't pick up environment changes so adding the cache file should have the same behavior. |
It does. If you install a missing dependency and rerun the build command, it works with what we have in |
@am11 that's a different scenario, in that case the configure step fails before we write the cache file (with this PR) so it'd be run again the next time. |
This PR is reverting my PR which was fixing the exact scenario. Also see #65533 for other issues with this kind of custom caching. |
@sbomer, this hasn't been touched in a year. Are you still working on it? Should it be closed? |
We can close it. |
This was deleted in #64370 because a canceled configure would leave around the cache file, causing subsequent invocations to start building with the incomplete configure.
I'm adding it back along with a fix to write the cache file after configure, as suggested in #64370 (comment). I made the same fix to the windows logic.
This saves 1-2s during incremental builds on my machine. Contributes to #47022.