Make /MD first-class in the app container, via the store CRT - #9
Conversation
MSBuild's UWP toolset satisfies /MD with the store CRT — VCRUNTIME140_APP.dll and friends, from the Microsoft.VCLibs framework — but modern MSVC ships no import libraries for it, so xwin cannot carry them. fetch-vclibs.sh makes its own: extract the *_app.dll set from the framework appx, read each export table with llvm-readobj, write a .def, generate the .lib with llvm-dlltool. Verified against the real x64 package: eleven DLLs, eleven libraries, and the resulting executable's imports match a Visual Studio build's exactly (issue #7). There is no default download URL, because Microsoft publishes no stable public link for the store framework: pass --appx with the package a Visual Studio install or a VS-built Dependencies folder provides, or --url plus an explicit --accept-license before any network access. The cache root is the second pinned default in common.sh — exported, because read-vcxproj.py will probe it from python to decide whether /MD can be honoured at all. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The override to the static runtime becomes the fallback: with the import libraries fetch-vclibs.sh generates in place, MultiThreadedDLL stays /MD, the project says so through a store_crt field and a --store-crt flag, and build.sh links the store CRT. Without them the old behaviour stands unchanged — silently, because that is the pre-store-CRT behaviour, not a new failure; build.sh re-checks at link time with an error that names the fix. Presence means both of the libraries the link cannot do without: a half-generated directory is exactly the case a bare existence probe gets wrong, and fetch-vclibs.sh's rename-on-success protects the same invariant from the other side. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
build.sh --store-crt shuts out msvcprt.lib and vcruntime.lib — their members import the desktop DLLs — and hands lld the generated *_app set instead; libcpmt.lib goes last, after every project --link-arg, because it carries the STL's static helpers (__std_find_last_trivial_2 and kin) that msvcprt.lib would have provided and the VCLibs DLLs do not export. Last means it satisfies only what the import libraries left unresolved, never shadowing an export they do have. The recipe is issue #7's, proven on hardware; the imports match a Visual Studio build's exactly. build-project.sh passes the flag when the evaluator says store_crt, and refuses — before the ten-minute compile, never rewriting the manifest — a project whose manifest does not declare the Microsoft.VCLibs.140.00 PackageDependency. The refusal matters because nothing later gives it: the Device Portal registers a package with unmet dependencies without complaint, and the loader then fails the launch as 0x80070002, naming nothing. run-on-device.sh warns after install when the device does not list a framework the manifest names, for the same reason. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The suite exports UWP_VCLIBS_ROOT=/nonexistent up front: the evaluator turns /MD-vs-/MT on the presence of the store-CRT cache, and presence in a test is a fixture, never whatever the developer's machine has fetched. Empty files stand in for the libraries — the probe is presence-only, and generation itself runs in the manual workflow, against the real appx. Covered: /MD honoured with the cache there (and said through store_crt and --store-crt), half a cache still meaning the static fallback, the fetch-vclibs.sh guards (consent before any network access, checked with an URL that answers nothing), build.sh's two refusals, the manifest dependency refusal at build-project.sh's door with its passing counterpart, and the pins: libcpmt.lib's expansion as the exec line's last token, and python's fallback root against common.sh's default. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Gotcha 19 grows its second branch — /MD honoured through the generated store CRT — and gotcha 20 is new: the Device Portal registers a package with unmet dependencies without complaint, and the loader then fails the launch as 0x80070002, indistinguishable from n°18's code at the portal. The heading becomes Twenty things; the environment table, layout, licensing and what-works sections gain their store-CRT rows, and porting-a-vcxproj.md says which road a /MD project is on. The changelog's claim that explicit environment values still win over --platform described the contract this branch's base revised: a typed --platform now refuses an environment that contradicts it. Said so. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 39 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (12)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The Makefile's list is what the PKGBUILD ships and the CI holds the tree to; a script missing from it exists in a checkout and nowhere else. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Closes #7, turning the hand-proven recipe into the toolchain's own road.
fetch-vclibs.sh(new): extracts the*_app.dllset from theMicrosoft.VCLibsframework appx, reads each export table withllvm-readobj, writes a.def, generates the.libwithllvm-dlltool. No default download URL — Microsoft publishes no stablepublic link for the store framework — so it takes
--appx(a VisualStudio install or a VS-built
Dependenciesfolder has one) or--urlplus an explicit
--accept-license, refused before any network access.Verified against the real x64 package: eleven DLLs, eleven libraries.
read-vcxproj.py: with both core libraries present,/MDishonoured and surfaced as
store_crt/--store-crt; without them thestatic override stands unchanged, as the fallback. Presence means both
libraries — a half-generated cache is what a bare probe gets wrong —
and
fetch-vclibs.shrenames the directory into place only when done.build.sh --store-crt: shuts outmsvcprt.lib/vcruntime.lib,links the generated
*_appset,libcpmt.libpinned as the link'sfinal token. A test build's imports name
vcruntime140_app.dllandmsvcp140_app.dll, matching a Visual Studio build's.build-project.shrefuses a store-CRT build whose manifest omitsthe
Microsoft.VCLibs.140.00<PackageDependency>(printing the exactelement, never rewriting the manifest);
run-on-device.shwarnsafter install when the device does not list a framework the manifest
names. Both exist because nothing else objects: the Device Portal
registers a package with unmet dependencies without complaint, and the
loader fails the launch as
0x80070002, naming nothing (gotcha 20).UWP_VCLIBS_ROOT=/nonexistentat the top, so adeveloper's real cache never decides a test); docs tell the two-branch
runtime story.
Not yet proven: this exact scripts-path output launching on the console —
the recipe it reproduces did, and the imports match; the hardware pass
remains the manual workflow.
🤖 Generated with Claude Code