Skip to content

Make /MD first-class in the app container, via the store CRT - #9

Merged
gianlucamazza merged 6 commits into
mainfrom
store-crt-vclibs
Aug 3, 2026
Merged

gianlucamazza merged 6 commits into
mainfrom
store-crt-vclibs

Conversation

@gianlucamazza

Copy link
Copy Markdown
Owner

Closes #7, turning the hand-proven recipe into the toolchain's own road.

  • fetch-vclibs.sh (new): extracts the *_app.dll set from the
    Microsoft.VCLibs framework appx, reads each export table with
    llvm-readobj, writes a .def, generates the .lib with
    llvm-dlltool. No default download URL — Microsoft publishes no stable
    public link for the store framework — so it takes --appx (a Visual
    Studio install or a VS-built Dependencies folder has one) or --url
    plus 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, /MD is
    honoured and surfaced as store_crt/--store-crt; without them the
    static override stands unchanged, as the fallback. Presence means both
    libraries — a half-generated cache is what a bare probe gets wrong —
    and fetch-vclibs.sh renames the directory into place only when done.
  • build.sh --store-crt: shuts out msvcprt.lib/vcruntime.lib,
    links the generated *_app set, libcpmt.lib pinned as the link's
    final token. A test build's imports name vcruntime140_app.dll and
    msvcp140_app.dll, matching a Visual Studio build's.
  • build-project.sh refuses a store-CRT build whose manifest omits
    the Microsoft.VCLibs.140.00 <PackageDependency> (printing the exact
    element, never rewriting the manifest); run-on-device.sh warns
    after 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).
  • Tests run hermetically (UWP_VCLIBS_ROOT=/nonexistent at the top, so a
    developer'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

gianlucamazza and others added 5 commits August 3, 2026 10:42
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>
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@gianlucamazza, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 39 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a97c4561-352b-42f1-95f9-0978fdd48c5a

📥 Commits

Reviewing files that changed from the base of the PR and between cb2b2b2 and 30742bd.

📒 Files selected for processing (12)
  • CHANGELOG.md
  • Makefile
  • README.md
  • docs/porting-a-vcxproj.md
  • scripts/build-project.sh
  • scripts/build.sh
  • scripts/common.sh
  • scripts/fetch-vclibs.sh
  • scripts/read-vcxproj.py
  • scripts/run-on-device.sh
  • tests/fixtures/evaluation/AppxManifest.store.xml
  • tests/run-tests.sh

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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>
@gianlucamazza
gianlucamazza merged commit 5feece0 into main Aug 3, 2026
3 checks passed
@gianlucamazza
gianlucamazza deleted the store-crt-vclibs branch August 3, 2026 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Store CRT (/MD) for app containers, via import libraries generated from VCLibs

1 participant