Bug 312680

Summary: [CMake] ccache hashes not portable across worktrees on Apple platforms
Product: WebKit Reporter: Simon Lewis <simon.lewis>
Component: CMakeAssignee: Simon Lewis <simon.lewis>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Simon Lewis
Reported 2026-04-18 07:33:43 PDT
WebKitCCache.cmake sets CCACHE_SLOPPINESS via set(ENV{...}), and the mac presets set CCACHE_BASEDIR via the preset environment block. Both apply only to the cmake process — when ninja later spawns ccache, neither is set, so cache entries are stored with absolute paths and a second worktree of the same revision gets ~0% hits. WebKitCCache.cmake also unconditionally overwrites CMAKE_CXX_COMPILER_LAUNCHER, discarding any -D the user passed. On APPLE, generate ${CMAKE_BINARY_DIR}/ccache-launcher — a sh wrapper that exports CCACHE_BASEDIR=${CMAKE_SOURCE_DIR}, CCACHE_NOHASHDIR, and the sloppiness flags before exec'ing ccache — and point CMAKE_{C,CXX,ASM,OBJC,OBJCXX}_COMPILER_LAUNCHER at it. Skip the block entirely if CMAKE_CXX_COMPILER_LAUNCHER is already set. With the existing -fdebug-prefix-map in OptionsMac.cmake this gives 100% hits (99.8% direct) in a fresh worktree against a cache warmed elsewhere.
Attachments
Simon Lewis
Comment 1 2026-04-18 07:38:33 PDT
EWS
Comment 2 2026-04-24 09:28:44 PDT
Committed 311955@main (b36a53b5d2b8): <https://commits.webkit.org/311955@main> Reviewed commits have been landed. Closing PR #63043 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.