Enable and document ccache + MSVC workaround for LLVM. #109
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.
Progress on #36. This fixes ccache when compiling with
-DCMAKE_BUILD_TYPE=RelWithDebInfo
and MSVC on Windows.Before:
After:
We had a different workaround in IREE: iree-org/iree#11841. I tried a solution like that one in this project but the meta-project nature of TheRock discourages setting implicit top level options. Instead, I followed how other options like
CMAKE_CXX_COMPILER_LAUNCHER
are forwarded to subprojects explicitly.Debugging notes
I followed https://ccache.dev/manual/4.10.2.html#_cache_debugging:
Then I looked in files like
D:\cache\ccache_debug\projects\TheRock\build\compiler\amd-llvm\build\lib\Support\CMakeFiles\LLVMSupport.dir\Allocator.cpp.obj.20250219_112722_308872.ccache-log
and found logs like these:
From there it was whack-a-mole trying to find where the
-Zi
flag came from, checking source code and eventually finding https://github.com/llvm/llvm-project/blob/c0c42c8b3213520700f15587ab8aa4477a286ff9/cmake/Modules/CMakePolicy.cmake#L9-L20. Reading the docs informed me that my prior workaround of manipulatingCMAKE_C_FLAGS_RELWITHDEBINFO
is outdated and actually won't work when the new policy is enabled.With the right fix, I deleted my build directory, re-ran a full build, and checked the ccache stats and log files to ensure that ccache was operating as expected again.