You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
error: build failed
Copy-Item -Force '.mcpp-bmi//pcm.cache/std.pcm'
-Destination 'pcm.cache/std.pcm'
→ The requested operation cannot be performed on a file
with a user-mapped section open.
Activity
[-]Bug: Windows 上 clangd 导致 mcpp build 假[/-][+]Bug: Windows 上 clangd 导致 mcpp build 假失败[/+]FarnaHerry commentedon Jul 30, 2026
补充:构建步骤时序
ninja 的 4 个步骤全部成功完成后,才执行失败的 Copy-Item:
[1/4] clang-scan-deps → main.cpp.ddi ✅
[2/4] mcpp dyndep → main.cpp.ddi.dd ✅
[3/4] clang++ → obj/main.o ✅
[4/4] clang++ (link) → bin/a.exe (4.2 MB) ✅
─────────────────────────────────────────────────────
Copy-Item .mcpp-bmi/.../std.pcm → pcm.cache/ ❌
此时二进制已完整生成,Copy-Item 是整个构建流程的最后一步、独立于编译链接的 IDE 辅助步骤。
补充:目标 pcm.cache/ 目录不存在
复现时 pcm.cache/ 目录压根不存在——Copy-Item 是第一个创建该路径的操作。这意味着被锁的不是目标文件(还不存在),而是源文件 .mcpp-bmi//pcm.cache/std.pcm。clangd 通过 .mcpp-bmi/ 路径打开并映射了 PCM,mcpp 再以读取源文件的方式打开同一路径时触发 Windows 的共享冲突。
补充:clangd 进程详情
复现时有两个 clangd 进程:
PID WorkingSet 说明
16476 6.5 MB 主进程(轻量)
32888 1005.8 MB 后台索引线程,已映射 PCM 文件
索引线程在启动后几秒内就会映射 PCM(42 MB),此后只要 clangd 不重启,文件锁持续存在。
补充:规避方式
mcpp build --no-cache 可以绕过——该模式下 mcpp 跳过 post-build PCM 复制,构建正常完成。但每次都是全量重编(~14s),不适合日常迭代开发。
补充:依赖场景
触发此 bug 的项目配置为 mcpp 项目依赖 eui-neo = { version = "0.5.3", features = ["app-main"] },使用 import std 和 clang 20.1.7。但这个 bug 与具体依赖无关,任何使用 import std 并触发 PCM 复制步骤的 mcpp 项目在 Windows + VS Code 下都会复现。
fix(build): verify fingerprint-scoped staging by size, so a read-deny…
Revert the bootstrap pin bump from this PR
fix(build): stage BMIs through mcpp instead of an in-place shell copy (…
chore: 2026.7.30.1 — BMI staging + cache-root convergence (#311)
fix(build): verify fingerprint-scoped staging by size, so a read-deny…
fix(build): stage BMIs through mcpp instead of an in-place shell copy…