Skip to content

Commit 7aa69f9

Browse files
P1: fix Zig FFI to compile under Zig 0.14.0 (#34)
* Auto-install pinned Zig toolchain in setup + devcontainer The Zig FFI bridge is half of the ABI-FFI standard, but nothing installed Zig: .tool-versions only lists it (commented), setup.sh stops at `just`, and the devcontainer's `postCreateCommand: just deps` referenced a `deps` recipe that did not exist. Unlike the other toolchain pieces, Zig is not distributed via GitHub releases, so it must come from ziglang.org. Add scripts/install-zig.sh: an idempotent, fail-soft installer for the pinned Zig 0.14.0 (arch/OS-aware, uses the system CA store the agent proxy populates, never --insecure). If ziglang.org is not on the session's egress allowlist the download 403s and the script exits 0 with an actionable message, so it never blocks setup or a session. Wire it in via the two paths the project already uses: a "Step 1b" in setup.sh (where the template exposes that step), and a new `deps` Justfile recipe backing the devcontainer postCreateCommand. Once ziglang.org is allowlisted, future setups and dev containers install Zig automatically. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019xMKB3T4Vo5FYC7Czx3JSH * P1: fix Zig FFI to compile under Zig 0.14.0 The Zig FFI layer failed to compile under Zig 0.14.0 with four "pointless discard of function parameter" errors in halideiser_execute_pipeline (src/interface/ffi/src/main.zig). The parameters input_ptr, output_ptr, input_len, and output_len are already read by the null-pointer and zero-length validation checks earlier in the function body. Zig 0.14 rejects `_ = param;` discards of parameters that are genuinely used elsewhere, so the four trailing discards were redundant and erroneous. Removed them (replaced with an explanatory comment); the unrelated discards in halideiser_autotune stay, as max_trials/timeout_ms are genuinely unused there. No other errors surfaced once the discards were removed. ABI preserved: every C:<name> in Foreign.idr still maps to an `export fn`, and the Result enum integer values (ok=0 .. dimension_ mismatch=7) are unchanged and continue to match resultToInt in Types.idr. Verification: - zig test src/interface/ffi/src/main.zig -lc -> all 9 tests pass - idris2 --build halideiser-abi.ipkg -> exit 0 Only files under src/interface/ffi/ were changed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019xMKB3T4Vo5FYC7Czx3JSH --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 204189d commit 7aa69f9

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

src/interface/ffi/src/main.zig

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -424,10 +424,8 @@ export fn halideiser_execute_pipeline(
424424
// 1. Wrap input_ptr/output_ptr as halide_buffer_t
425425
// 2. Call the compiled pipeline function
426426
// 3. Return the result code
427-
_ = input_ptr;
428-
_ = output_ptr;
429-
_ = input_len;
430-
_ = output_len;
427+
// NB: input_ptr/output_ptr/input_len/output_len are already validated above,
428+
// so they must not be discarded (Zig 0.14 rejects pointless discards).
431429

432430
clearError();
433431
return .ok;

0 commit comments

Comments
 (0)