From 19c786470d5ac444e62666021a42b10ce0341a9d Mon Sep 17 00:00:00 2001 From: guest271314 Date: Tue, 8 Sep 2026 00:29:38 +0000 Subject: [PATCH 1/3] Use alias for zig cc => zigcc There's no zigcc --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2bf9306c6..44b16b038 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,7 @@ $ scriptc coverage hello.ts WASI and other cross-target builds require Zig. Its bundled WASI libc produces a portable WASI Preview 1 module through the production LLVM backend: ```console +$ alias zigcc='zig cc' $ SCRIPTC_CC=zigcc SCRIPTC_TARGET=wasm32-wasi scriptc build hello.ts --no-keep-c -o hello.wasm >/dev/null $ file hello.wasm hello.wasm: WebAssembly (wasm) binary module version 0x1 (MVP) From 67d48679ce9d13eb807a4641b82002411174d4ae Mon Sep 17 00:00:00 2001 From: guest271314 Date: Tue, 8 Sep 2026 01:43:52 +0000 Subject: [PATCH 2/3] Update README.md --- README.md | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 44b16b038..bef28cff3 100644 --- a/README.md +++ b/README.md @@ -112,10 +112,23 @@ $ scriptc coverage hello.ts ## Build WebAssembly -WASI and other cross-target builds require Zig. Its bundled WASI libc produces a portable WASI Preview 1 module through the production LLVM backend: +WASI and other cross-target builds require Zig. + +Note: + +`SCRIPTC_CC=zigcc` is not a command that `scriptc` runs; it's a keyword the compiler recognizes. In `packages/compiler/src/backend/native-toolchain.ts`, `resolveCc()` compares the value literally and maps it to the argv prefix `["zig", "cc"]`: + +```javascript +if (cc !== "zigcc") { + throw new Error(unknown SCRIPTC_CC '${cc}' (supported: clang, zigcc)); +} +if (target === "") return { argv: ["zig", "cc"], ... }; +``` +Only the exact strings `clang` or `zigcc` are accepted; `scriptc` then spawns `zig cc` itself. The only prerequisite is having `zig` on `PATH`. + +Its bundled WASI libc produces a portable WASI Preview 1 module through the production LLVM backend: ```console -$ alias zigcc='zig cc' $ SCRIPTC_CC=zigcc SCRIPTC_TARGET=wasm32-wasi scriptc build hello.ts --no-keep-c -o hello.wasm >/dev/null $ file hello.wasm hello.wasm: WebAssembly (wasm) binary module version 0x1 (MVP) From 70fdd68acf5c54e67a7a9d16b635b922e24120fb Mon Sep 17 00:00:00 2001 From: guest271314 Date: Tue, 8 Sep 2026 01:55:09 +0000 Subject: [PATCH 3/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bef28cff3..1cb104ccf 100644 --- a/README.md +++ b/README.md @@ -120,7 +120,7 @@ Note: ```javascript if (cc !== "zigcc") { - throw new Error(unknown SCRIPTC_CC '${cc}' (supported: clang, zigcc)); + throw new Error(`unknown SCRIPTC_CC '${cc}' (supported: clang, zigcc)`); } if (target === "") return { argv: ["zig", "cc"], ... }; ```