Closed
Description
Context
Found while implementing #253 (design doc: .agents/docs/2026-07-20-issue-253-feature-flags-and-per-os-features-design.md §2.3).
mcpp has two platform axes, and they key on different things:
mcpp.<os>descriptor sections are applied by textual splice at parse time, keyed onmcpp::platform::xpkg_platform— a compile-time HOST constant (src/platform/common.cppm:96-105, chosen via_WIN32/__APPLE__/__linux__). Splice:src/manifest/xpkg.cppm(osKey = osOverride.empty() ? xpkg_platform : osOverride).target_cfg/[target.'cfg(...)']conditional config is evaluated against the RESOLVED target triple (cfgpred::context_forinsrc/build/prepare.cppm, host fallback only for native builds).
Consequence
Cross-compiling (e.g. the 0.0.100-era mcpp build --target x86_64-windows-gnu MinGW flow) against an xpkg dependency with per-OS sections selects the host OS section: per-OS sources, flags, deps, include_dirs, features (#253), and the xpm version/asset table all come from the wrong leg. Native builds are unaffected (host == target), which is why this stays invisible in the normal three-platform CI.
Direction (needs its own design pass)
- Build/prepare adoption sites (
prepare.cppmxpkg dep manifest synthesis) should pass the resolved target OS (mapped to xpkg vocabulary linux/macosx/windows) asosOverride— the parameter seam already exists (it powersmcpp xpkg parse --all-os). - pm/install-time consumers need separate judgment: source packages compiled for the target want target-keyed sections, while host-tool packages want host — an audit of
synthesize_from_xpkg_lua/list_xpkg_versionscall sites is required before flipping anything. - Zero behavior change for native builds must be locked by e2e (host == target ⇒ same splice).
Deliberately split out of #253 (its unblock — native macOS/windows opencv dnn legs — doesn't need this).
Metadata
Metadata
Assignees
Labels
No labels
Activity
feat(features): per-feature per-glob flags + per-OS features semantics (
batch: #261 windows cmdline, #257 clang depfile, #258 conditional per…
Sunrisepeak commentedon Jul 21, 2026
Fixed in 0.0.102 (PR #264, squashed to main as 5807e36).
Host and target platform are now distinct types (
mcpp.platform.axis:HostPlatform/TargetPlatform) with no conversion between them and no construction from a bare string.synthesize_from_xpkg_lua's platform parameter lost its host default and is now required, so every call site must name its axis — a silent default is how this survived. xpkg per-OS sections and the xpm version/asset table now key on the resolved target for anything compiled into the build; toolchain payload listing correctly stays on the host.Classification of each call site is in the commit message. Pinned by unit tests: the axes are mutually inconvertible (
static_assert), a per-OS splice selects each target's own section and none of the others, and host==target produces a byte-identical splice (the safety net for existing platforms' behaviour).One honest gap: the planned mingw-cross e2e consuming an xpkg dep with per-OS sections did not land — a throwaway MCPP_HOME re-installs the whole cross toolchain and the e2e harness has no fixture for reusing the host registry. Semantics are pinned by the unit tests instead; the gap is recorded in the design doc and changelog rather than papered over.