Skip to content

Windows: the toolchain checks name their fix — link probe, SDK stubs, Metal and Git installs, pinned wheels - #206

Merged
LNPANDY merged 14 commits into
mainfrom
win-link-probe-followup
Oct 31, 2026
Merged

LNPANDY merged 14 commits into
mainfrom
win-link-probe-followup

Conversation

@LNPANDY

@LNPANDY LNPANDY commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

Fix or feature

  • Fix
  • Feature

What and why

The Windows dependency experience stops guessing. Seven commits, each one a step the panel can name:

  • The link probe's failure report survives the panel and names the one suspect: every failed strategy, the linker's self-check, the exact command to try by hand, and — for a non-ASCII SDK path — the hint that has fixed this exact shape before, now translated (the model's translator rides the probe call, the panel never sees a raw key).
  • The SDK check keeps libSystem.tbd only: iOS executables use LC_MAIN, so a complete iPhoneOS SDK ships no crt*.o — checking for one rejected every correct download before the probe could link (review blocker, fixed).
  • The Metal zip a player downloads is installed by the app (bin\metal.exe / ios\bin\metal.exe), with unpacking progress and a clear error when the zip is not the Metal Developer Tools download.
  • The SDK install brings its own PortableGit (the download needs git; about 45 MB), named in the log.
  • install-all follows multi-step fixes, and the venv packages (lz4, capstone, fonttools, backports.zstd, nsz) ride in the zip — now pinned to exact versions, wheels only.
  • The wheels-args checks run without PySide6, as the CI job does.

CI green; review items from @v0lumehi addressed (crt check dropped, hint translated, wheels pinned, Swedish added, title and body now match the scope).

@v0lumehi v0lumehi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The three-attempt report and the wrapped block are a clear improvement. Two bugs keep the new text from reaching the player and the log, though:

  1. dep.row.log gets two arguments for three placeholders. The string is dependency %@: [%@] %@, and model.py calls self.t('dep.row.log', <title>, <detail>). In localization.t(), py % args raises TypeError and the raw template comes back, so every logged row reads dependency %@: [%@] %@. That is exactly the line the exported last-run.log was meant to carry. Either drop the [%@] or pass the state as the middle argument.
  2. dep.fix.nonascii is shown as the raw key. link_failure_summary appends it at the end of the joined detail, but ui.py only translates a detail that starts with dep.. A detail starting with link failed goes through short_path unchanged, so the player with the non-ASCII SDK path, the one this hint is for, sees the literal dep.fix.nonascii. Translating the key before it is joined in (or returning it as a separate field) fixes it. A test asserting the translated sentence in the panel text would catch both.

Smaller:

  • d.title_key.replace('dep.', 'dep.') does nothing.
  • The Swedish column of dep.fix.nonascii and dep.row.log is still the English text.

…s the one suspect

The owner's second run used the new three-strategy probe and came back
"link failed 3 ways" with the linker's self-check green (LLD 23.1.4 runs) —
and the interesting part was cut off at the panel's edge, exactly where the
answer lived.

- The failure summary now keeps every attempt's last three output lines
  (not one), echoes the exact clang command to try by hand, and — when the
  SDK path is not pure ASCII — appends the fix that matches this machine:
  ld64.lld's Windows port can fail to open narrow-char paths while clang's
  front end (the compile probe, green there) handles them. The owner's SDK
  sits under C:\Users\QC-北\... — that hint is the most likely fix.
- The panel moves a detail longer than ~140 characters into its own wrapped
  block under the row instead of eliding it to nothing.
- Every not-ok dependency row is logged with its full detail, so an exported
  last-run.log always carries what the panel could not show.

Verified: python3 -m unittest discover -s frontend-qt/tests -> 139 tests,
9 skipped, 0 failures (2 new: the summary names all strategies and the
by-hand command, and flags a non-ASCII SDK path).
The Mac build bundles every tool it may; the Windows build auto-downloads
all of them but one — Metal Developer Tools, which Apple gates behind an
Apple ID, so the browser download is the licensed path. Until now the app
stopped there: the row linked the download page and accepted an already
unpacked folder.

The Metal row's button now takes the downloaded zip itself: it is validated
(metal.exe in bin/ for 5.x/6.x or ios/bin/ for 4.x), unpacked into the
tools folder the other toolchains live in — surviving app updates — and the
folder is remembered in toolchain.json. An already unpacked folder is
equally accepted, and a zip without metal.exe is refused with what to
check. The player's part shrinks to: download from Apple, pick the zip.

Verified: python3 -m unittest discover -s frontend-qt/tests -> 142 tests,
9 skipped, 0 failures (3 new: a 6.x-layout zip unpacks into the tools dir
with staging cleaned, a 4.x ios/bin layout is accepted, a zip without
metal.exe is refused leaving nothing behind; plus the routing shape test).
…wn git, and the venv packages ride in the zip

Three gaps from the owner's fresh-machine run (new user, nothing installed):

- Install all stopped after the Python interpreter: the loop's attempted set
  was keyed by id, so the row's SECOND fix (venv + pip packages, which
  replaces the interpreter row the pass had just created) was skipped as
  "already tried" — the docstring promised the opposite. attempted is now
  keyed by (id, fix): a row whose install command changed is retried, a
  genuinely failed one is not.
- The SDK clone failed three times with "git is not installed". The clone
  needs git, but git was only ever installed by the repository-download
  flow, which a fresh machine never runs. The SDK install now downloads
  PortableGit itself (per-user, the same helper the repo flow uses —
  toolchain.git_exe() already looks there) before cloning.
- The log carried literal "dependency %@: [%@] %@" lines: the new row-logging
  call passed two arguments to a three-placeholder string, and t()'s
  format-failure fallback kept the raw text. Three args now.

**Python + packages, bundled** (the owner's ask): the release workflow
downloads the venv wheels (lz4, capstone, fonttools, backports.zstd, nsz)
at packaging time and puts wheels/ beside the exe; the venv step installs
from disk (--no-index) — no PyPI round-trip, seconds not minutes. Source
runs keep the PyPI path. Wheels are ~15 MB in the zip.

Metal stays as agreed: user downloads from Apple (Apple ID), the app
unpacks the picked zip and remembers the folder.

Verified: python3 -m unittest discover -s frontend-qt/tests -> 146 tests,
9 skipped, 0 failures (4 new: offline/online pip args, the log row string
with three args, plus the metal-zip and pick-flow tests from this branch).
@LNPANDY
LNPANDY force-pushed the win-link-probe-followup branch from d22df12 to 2ddf2ed Compare October 29, 2026 19:06

@v0lumehi v0lumehi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update, @LNPANDY. Second pass over the current head (2ddf2ed):

Fixed

  • dep.row.log now gets the state as its middle argument, so the logged row is filled in. The no-op .replace('dep.', 'dep.') is gone too.

Still open

  1. dep.fix.nonascii still reaches the player as the raw key. link_failure_summary appends the key to the joined detail, and ui.py only translates a detail that starts with dep.. A detail starting with link failed passes through unchanged, so the player with the non-ASCII SDK path sees the literal dep.fix.nonascii. The new test asserts the raw key in the summary, which is why it passes. Translating the key before joining (or returning the hint as its own field that ui.py renders with self.m.t) fixes it, with a test on the rendered panel text.

New in this revision
2. The release zip now carries unpinned wheels. build-qt.yml runs pip download lz4 capstone fonttools backports.zstd nsz with no versions or hashes, and the result ships in the player's zip. #154 bundles everything else from pinned, checksummed sources, and the wheels should follow that: a requirements file with exact versions and --hash lines, then pip download --require-hashes --only-binary=:all: --platform win_amd64 --python-version 3.12 -r <file>. Otherwise every release build can pick up a different (or a compromised) package version without anyone seeing it in a diff.
3. Scope. The PR now also installs the Metal zip, downloads PortableGit, ships the wheels and changes the release workflow, while the title and body still describe the link probe report. Could you either split those into their own PR or update the title and body? The workflow change also changes how the Windows zip is built, so it is worth a line in the release notes.

Small

  • The Swedish column of the new strings is still the English text (dep.fix.nonascii, dep.row.log, and the new Metal and PortableGit strings in the Swift table's sv dictionary).

CI is green on all 9 checks.

…tegy may just fix it

The owner's machine finally produced a readable failure, and it names the
real problem: "ld64.lld: error: undefined symbol: puts" across all three
strategies, with the linker's self-check green. That is libc not resolving —
nothing to do with Metal (reinstalling it was a red herring). Two candidate
causes, now both covered:

- The SDK lacks its link stubs (usr/lib/libSystem.tbd, crt*.o): the probe
  checks both before linking and fails with "the download is incomplete —
  re-download or use the xip route" instead of an undefined-symbol list.
  The repo's iPhoneOS26.0.sdk does carry usr/lib/libSystem.tbd, so a
  partial checkout would read exactly like this.
- The cross driver does not add -lSystem the way Apple's does: the probe
  gained a fourth strategy passing it explicitly, and build_app.link (the
  real build) now passes -lSystem too — idempotent when the driver already
  does it, decisive when it does not.

And when all four fail, the summary appends a -v re-run of the first
strategy, keeping the driver's link command, the runtime libs and the
library search paths (12 lines) — so the next report shows whether -lSystem
was passed and what the search paths were.

Verified: python3 -m unittest discover -s frontend-qt/tests -> 175 tests,
9 skipped, 0 failures.

@v0lumehi v0lumehi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Third pass, on the two new link-probe commits (f5aaf48, ba4eec7):

Blocker: the new SDK check rejects a complete SDK. probe_link now fails when usr/lib has no crt*.o. A real, complete iPhoneOS SDK has none: Xcode 27.1's iPhoneOS.sdk/usr/lib holds libSystem.tbd, libSystem.B.tbd and the _asan variants, but no crt1.o or any other crt*.o (iOS executables use LC_MAIN, so no crt object is linked). So every player with a correct SDK would now get "SDK is missing usr/lib/crt*.o: the download is incomplete" and the probe stops before it links. Please drop the crt*.o check and keep only libSystem.tbd.

Good:

  • -lSystem in build_app.link and as a fourth probe strategy is a sensible fix for a cross driver that does not add libSystem itself. Apple's driver ignores the duplicate.
  • The capped verbose run is a useful last report.

Still open from my second pass:

  1. dep.fix.nonascii is still appended to the joined detail and reaches the panel as the raw key (ui.py only translates a detail that starts with dep.). The test still asserts the raw key in the summary.
  2. build-qt.yml still runs pip download without versions or hashes, and the result ships in the player's zip.
  3. The PR's title and body still describe only the link-probe report, while it now also installs the Metal zip, downloads PortableGit, ships the wheels, changes the release workflow and checks the SDK.
  4. The Swedish column of the new strings is still English.

CI is still running on ba4eec7.

@v0lumehi v0lumehi added windows Windows (the Qt front end) ci Workflows and repository tooling bug Something isn't working labels Oct 30, 2026
@LNPANDY LNPANDY mentioned this pull request Oct 30, 2026
2 tasks done
…s no crt*.o

iOS executables use LC_MAIN, so even a complete iPhoneOS SDK has no crt object in usr/lib; checking for one rejected every player's correct download before the probe could link (review, v0lumehi).
link_failure_summary embedded the raw dep.fix.nonascii key in its joined text, which ui.py never translates (it only translates a detail that starts with the key). The model's translator now rides the probe call, and the test asserts the translated hint.
…s only

The zip ships these packages to players; the supply is now pinned (lz4 4.4.5, capstone 5.0.9, fonttools 4.68.0, backports.zstd 1.8.0, nsz 5.0.0) and sdists are out.
@LNPANDY LNPANDY changed the title Windows: the link probe's failure report survives the panel, and names the one suspect Windows: the toolchain checks name their fix — link probe, SDK stubs, Metal and Git installs, pinned wheels Oct 31, 2026
@github-actions github-actions Bot added the launcher The NX2Apple launcher app label Oct 31, 2026
…e is gone

The venv keeps main's package list (zbic joined) with this branch's offline wheels install; the CI wheels download gains zbic 1.0.1.post1; localization.py regenerated over the merged Swift table.
@LNPANDY
LNPANDY merged commit ae04e9d into main Oct 31, 2026
9 of 10 checks passed
xvimnt pushed a commit to xvimnt/NX2Apple that referenced this pull request Oct 31, 2026
The merge of LNPANDY#206 left two German entries for the key. A Swift dictionary literal with a duplicate key traps at runtime, so swift test on main stopped at CheatsIOSNoteTests. The newer entry stays because it matches the English text.
@v0lumehi
v0lumehi deleted the win-link-probe-followup branch November 2, 2026 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ci Workflows and repository tooling launcher The NX2Apple launcher app windows Windows (the Qt front end)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants