Skip to content

fix(ci): use CMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded for sccache (documented fix)#432

Merged
BenJule merged 1 commit into
masterfrom
fix/windows-cmake-debug-format
Jun 3, 2026
Merged

fix(ci): use CMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded for sccache (documented fix)#432
BenJule merged 1 commit into
masterfrom
fix/windows-cmake-debug-format

Conversation

@BenJule

@BenJule BenJule commented Jun 3, 2026

Copy link
Copy Markdown
Owner

Root cause (properly researched this time)

Per the sccache README: cmake sets /Zi by default for MSVC, which writes debug info to a shared .pdb file. With Ninja + sccache + /MP all running parallel cl.exe processes, multiple processes race to write the same PDB → C1041.

Official fix

For cmake ≥ 3.25 (we use ~3.31.0), the documented solution is:

-DCMAKE_POLICY_DEFAULT_CMP0141=NEW
-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded

This instructs cmake to pass /Z7 to all targets (including vendored subprojects like admesh), embedding debug info in each .obj file. No shared PDB → no contention.

Previous attempt (/Z7 via CMAKE_CXX_FLAGS_RELEASE) only affected top-level targets and missed subprojects that set their own flags (like admesh).

Per sccache documentation: cmake sets /Zi by default for MSVC, which
writes debug info to a shared .pdb file. With Ninja + sccache + /MP
running parallel cl.exe processes, this causes C1041 (PDB contention).

Official fix (cmake >= 3.25): set CMAKE_POLICY_DEFAULT_CMP0141=NEW and
CMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded, which instructs cmake to
use /Z7 (debug info embedded in .obj) instead of /Zi for all targets.

Replaces the manual /Z7 flags in CMAKE_CXX_FLAGS_RELEASE which only
affected top-level targets and missed vendored subprojects.
@BenJule BenJule self-assigned this Jun 3, 2026
@BenJule BenJule merged commit 2e38642 into master Jun 3, 2026
5 of 6 checks passed
@BenJule BenJule deleted the fix/windows-cmake-debug-format branch June 3, 2026 11:30
@github-actions github-actions Bot added area: ci GitHub Actions, CI/CD platform: windows Windows-specific issue labels Jun 3, 2026
@github-actions github-actions Bot added this to the v02.07.00-dev milestone Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci GitHub Actions, CI/CD platform: windows Windows-specific issue

1 participant