Repository navigation
Done
Description
Summary
When targeting 32-bit Windows ("mcppls.buildDiscovery.mcppTarget": "i686-windows-msvc" / --target=i686-pc-windows-msvc), the bundled clangd.okb fails to build module BMIs for any C++23 module that directly or indirectly includes <Windows.h> (or <winnt.h>), reporting:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\um\winnt.h:1064:5: error: MS-style inline assembly is not available: target MC unavailable
1064 | __asm {
| ^
C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\um\winnt.h:1080:5: error: MS-style inline assembly is not available: target MC unavailable
1080 | __asm {
| ^
C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\um\winnt.h:1096:5: error: MS-style inline assembly is not available: target MC unavailable
1096 | __asm {
| ^
3 errors generated.
module worker compilation failed
This cascades and causes all downstream modules depending on <Windows.h>-using modules to fail prerequisite BMI compilation, while non-<Windows.h> modules (such as std, std.compat, boost, spdlog, etc.) build cleanly.
Environment
- OS: Windows 11 (
win32-x64,10.0.26300) - VS Code:
1.147.0 - mcppls:
0.24.1(mcppls-kit-openkal-0.24.4) - Bundled clangd:
23.1.0-mcppls.12(clangd/openkal/bin/clangd.okb,llvm-base-version: 23.1.0) - mcpp:
2026.11.22.1 - Target:
i686-windows-msvc(--target=i686-pc-windows-msvc) - MSVC Sysroot:
14.44.35207 - Windows SDK:
10.0.26100.0
Minimal Reproduction
- Create a C++23
mcppproject with a module interface unit (.ixx) that includes<Windows.h>in the global module fragment:module; #include <Windows.h> export module win_demo; export inline DWORD getTick() { return GetTickCount(); }
- Configure VS Code with:
{ "mcppls.buildDiscovery.mcppTarget": "i686-windows-msvc" } - Open a
.cppfile importingwin_demoin VS Code withmcpplsenabled. - Observe the module worker failing with
winnt.h:1064/1080/1096: error: MS-style inline assembly is not available: target MC unavailable.
Verification & Comparison
- CLI build succeeds: Running
mcpp build --target i686-windows-msvc(which invokes fullclang++with the X86 target backend) compiles the exact same modules and<Windows.h>headers with zero errors. - 64-bit target workaround succeeds: Switching
mcppls.buildDiscovery.mcppTargetto"x86_64-windows-msvc"eliminates the errors immediately, becausewinnt.honly uses__asmblocks under_M_IX86(lines 1018–1103) and uses plain C shift macros under_M_AMD64(lines 1013–1015).
Root Cause & Suggested Fix
- Under 32-bit Windows (
_M_IX86), Windows SDKum/winnt.hdefinesInt64ShllMod32,Int64ShraMod32, andInt64ShrlMod32using MSVC-style__asm { ... }inline assembly blocks. - Clang requires LLVM's X86 Target MC /
X86AsmParserto parse MS-style inline assembly even during syntax/semantic/BMI compilation. - The bundled
clangd.okb(23.1.0-mcppls.12) appears to be built without linking/initializing the LLVMX86Target MC /X86AsmParsercomponents. - Suggested fix: Enable and link LLVM
X86Target MC /X86AsmParser(e.g. includeX86inLLVM_TARGETS_TO_BUILDand initializeLLVMInitializeX86AsmParser/LLVMInitializeX86TargetMC) when building the bundledclangd.okbpayload so 32-biti686-windows-msvcWindows SDK headers parse cleanly.
Metadata
Metadata
Assignees
Labels
No labels
Activity
server 0.24.2, vscode 0.24.2: modules that include <Windows.h> build …
Sunrisepeak commentedon Nov 26, 2026
Thanks for the detailed report and the 64-bit comparison — it pinned this down quickly.
Cause (not an engine without X86; the bundled engine has always built it): clang parses MS-style
__asm { }with the target's MC and assembly parser, which clangd did not register. clangd's editor path hides the resulting "target MC unavailable" diagnostic, but a module build cannot: clang writes no module interface once an error has been reported, so the module that includes<Windows.h>fori686-windows-msvc(and every module importing it) failed.winnt.huses__asmonly under_M_IX86, which is whyx86_64-windows-msvcwas never affected.Fix: mcppls-clangd 0.0.24 (
23.1.0-mcppls.13, patch 0049: the x86 MC and assembly parser are linked and registered before anything compiles, the module worker included), carried by mcppls 0.24.2 / VS Code extension 0.24.2 (releasevscode-v0.24.2, currently a draft until it is verified and published). Reproduced on the unmodified engine on Linux (--target=i686-pc-windows-msvc, a module with an__asmblock: the worker prints your error and the importer reportsmodule not found), fixed on the patched one, and covered by two conformance fixtures:compdb-i686-asm(an__asmmodule, Linux) andcompdb-clangxx-msvc-i686-windows-h(your shape with the SDK's own<Windows.h>, Windows), both green in CI.Limit: the libraries are not linked for an arm64 engine (Apple silicon, Linux arm64): the arm64 image that linked them ended by SIGBUS in CI, cause not found. On an arm64 host the module still does not build; an x64 host is fixed.
Design and what implementation found:
.agents/docs/2026-11-26-issue-100-engine-batch-design.md. I'll close this once the release is published.0.25.0: a series, because the server changed; and the rule for which …
Sunrisepeak commentedon Nov 26, 2026
Correction: the fix ships as 0.25.0 (the whole series), not 0.24.2 as I wrote earlier. 0.24.2 never shipped: any change to the server (here the engine payload, mcppls-clangd 0.0.24 / clangd 23.1.0-mcppls.13) moves the series, and the release rule is now written in docs/92-release.md and enforced in tooling (#102). The v0.25.0 release is a draft until the maintainer publishes it; the fix covers x64 hosts (the aarch64 image keeps the old behaviour: see the 0.25.0 changelog). I will close this once the release is published.
Sunrisepeak commentedon Nov 26, 2026
插件已上传
Sunrisepeak commentedon Nov 26, 2026
0.25.0 is published (https://github.com/Sunrisepeak/mcpp-language-server/releases/tag/v0.25.0). The fix covers x64 hosts; the aarch64 limit and the other follow-ups are tracked in #104.