Docs promise a managed Zig download on every platform; the Windows CLI has no download table at all

Aperta
#773 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
zig
Ambito
build-system

Direzione di ricerca

Start with src/tooling/toolchain.zig, where currentDownload() selects platform entries and install() currently unpacks .tar.xz; inspect the release assets and relevant toolchain tests. Confirm the Windows asset’s format and checksum, then ensure Windows can install the pinned Zig toolchain or update the documented limitation and error message. Done when Windows behavior and the three cited documentation pages agree.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Environment

  • @native-sdk/cli 0.11.1 (win32-x64)
  • Windows 11, Node 24.22.2, no zig on PATH, no ~/.native/toolchains/

What happens

$ native build shelltest --yes
zig 0.16.0 is required but was not found, and this platform has no
managed toolchain download. Install it from the official Zig
download page, then re-run.

--yes does not help, because the failure is not a consent problem.

Why: the Windows binary is compiled without any Zig download entries

src/tooling/toolchain.zig selects the download table at comptime:

fn currentDownload() ?Download {
    return switch (builtin.target.os.tag) {
        .macos => switch (builtin.target.cpu.arch) { .aarch64 => ..., .x86_64 => ..., else => null },
        .linux => switch (builtin.target.cpu.arch) { .aarch64 => ..., .x86_64 => ..., else => null },
        else   => null,
    };
}

offerInstall turns that null straight into a hard error:

const download = currentDownload() orelse {
    // "this platform has no managed toolchain download"
    return error.UnsupportedPlatform;
};

I confirmed this is decided at build time, not at runtime, by inspecting the shipped
cli-win32-x64/bin/native.exe:

needle occurrences in native.exe
managed toolchain download 1
zig-aarch64-macos-0.16.0 0
zig-x86_64-linux-0.16.0 0
zig-x86_64-windows-0.16.0 0

The macOS/Linux archive names are dead-code-eliminated on a Windows build, so no
runtime condition could ever reach them. Adding zig-x86_64-windows-0.16.0 to
currentDownload() is the whole fix — the release index already publishes
zig-x86_64-windows-0.16.0.zip (sha256 68659eb5f1e4eb1437a722f1dd889c5a322c9954607f5edcf337bc3684a75a7e,
verified locally). Note install() currently unpacks .tar.xz, so the Windows
entry would need a .zip branch (or point at the .tar.xz asset, which ziglang.org
also ships for Windows).

What the docs say

/docs/quick-start lists the prerequisite as "macOS 14+ or newer, Linux, or Windows",
then, with no platform qualifier:

The Zig toolchain. native dev|build|test use the Zig on your PATH when its version
is compatible, and otherwise offer to download the pinned version into
~/.native/toolchains/ (checksum-verified; pass --yes to skip the prompt in scripts).

/docs/zig repeats it:

native dev, native build, and native test use zig from PATH when its version
matches; otherwise, they offer to download the pinned, checksum-verified version into
~/.native/toolchains/.

/docs/platform-support states "macOS, Linux, and Windows run full desktop apps through
their own platform hosts" and does not flag the toolchain as a Windows gap anywhere on
the page.

Three pages promise the download on a platform where it cannot happen.

Expected

Either (a) ship the Windows entry so --yes works as documented, or (b) if that is
deliberate, document it as a per-platform limitation in the Zig toolchain section and in
the platform-support matrix, and change the message to say "on Windows, install Zig
0.16.0 yourself" rather than implying every platform lacks it.

Lingua principale
Zig
Stelle
7.9k
Fork
335
Merge medio
10h 33m
PR unite (30g)
147

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di vercel-labs/native

Tutte le issue di vercel-labs/native

Issue simili

Altre issue su Build System

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.