Repository navigation
[Feature] 统一 Windows MSVC ABI 的 CRT 选择,支持普通 clang++ 并同步标准库 BMI #718
Description
Activity
Completed across two releases; closing with the readings.
2026.9.28.1 (#727) implemented the CRT model on the MSVC ABI for every driver:
clspells it/MDor/MT, clang++-fms-runtime-lib=dllorstatic, and the one resolved choice reaches compilation, the std and std.compat BMIs (whose cache identity includes it) and the link (behaviours 1 to 3).cxx_runtimeandlinkagestate it, with no new key; a hand-written CRT word that agrees is warned as redundant, one that contradicts is refused, a dependency's contradicting word is refused, and the debug words are refused, since the model has no debug axis (4, 5). Non-MSVC targets receive no MSVC word (4).2026.9.28.2 (#730, #731) completes behaviour 6, the runtime facts, the placement and the packing. One resolver (
mcpp.build.runtime_placement, SPEC-006 §3.7.1) decides the files beside a Windows program: the MSVC C++ runtime is one versioned set, the toolset's unless a complete, strictly newer set is offered; a dependency's copy is stated once as a packaging fault; the contract governs whether the set is carried. The plan, the post-link placement andmcpp packread that one answer, andresolution.jsonrecords it. Every action of an MSVC-ABI build runs with the toolset's runtime first onPATH, so Qt's tools start from a payload that carries no runtime of its own (xim:qt-base6.11.1 revision 1, openxlings/xim-pkgindex#898).Readings on GalTranslPP (Windows, llvm@22.1.8 over MSVC 14.51.36231):
- the release canary with the 2026.9.28.2 candidate: 4 of 4 commands held (build, run, two packs);
- the project's CI with the pin moved to 2026.9.28.2 (构建优化:依赖由构建取得,运行与打包分离(mcpp run / mcpp pack --format release),并加入 Windows CI Sunrisepeak/GalTranslPP#3, run 36375738971): build, run and pack succeed;
- the same without the hand-written
dialect_cxxflags = ["-fms-runtime-lib=dll"]in its five manifests (run 36378870254): success, no redundancy warning, and the packages carryMSVCP140*andVCRUNTIME140*beside the programs, so the model alone chose the dynamic CRT.
Behaviour 7 (prebuilt external libraries must match the chosen CRT) is documented in docs/20. The record is
.agents/docs/2026-09-28-ecosystem-design-and-optimisation-plan.md§8.
需求与已有讨论的关系
相关但独立的通用参数配置请求:#717(目标条件下的 dialect_cxxflags)。CRT 语义配置完善后,本项目可不再手写该参数,但 #717 仍适用于其他平台专用的模块图参数。
希望完善 Windows MSVC ABI 下的 CRT 选择,使同一个语义配置能够覆盖
cl、clang-cl和普通clang++,并统一用于源码编译、标准库模块和缓存。这是 #649 E10 的后续功能请求:
使用场景
2026.9.26.2,LLVM22.1.8,普通clang++驱动,目标为 Windows MSVC ABI。import std;,并使用 Qt/vcpkg 提供的动态 release CRT 库。这能让参数同时到达项目源码及 std BMI,但项目需要知道驱动拼写和模块参数通道,还存在平台条件声明的问题。
按本地源码
52549fbb2d17939e89efb1e05e0c2717bf30d96c:本次诉求是对普通 clang++ / MSVC ABI 补齐语义配置,不是要求改变其他平台的默认运行库策略。
配置形式:供讨论,不限定必须新增字段
若现有
linkage/cxx_runtime足够表达需求,可以完善现有机制并明确文档,避免重复配置。若需要直接表达 CRT 选择,可考虑沿用现有 ABI 配置位置,例如:
是否支持 debug CRT 可以分阶段决定;当前项目的直接需求是普通 clang++ 下显式选择动态 release CRT。
两个维度的预期映射:
debug = true表示调试信息需求,不应自动等价于 debug CRT。期望行为
linkage、cxx_runtime及已有默认行为统一解析,记录优先级;对已知矛盾给出明确诊断,不输出互相覆盖的 CRT 参数。建议验证
import std;的最小程序能够编译链接,TU 与标准库 BMI 使用一致配置。不要求本 issue 一次实现所有配置维度,但希望先有受支持的方式,让 LLVM/clang++ 行显式选择动态 release CRT,并让 std BMI、缓存及运行库记录保持一致。