a73x

ab23cc7f

fix: make install on a Mac names the native target, which is the only one that builds

a73x   2026-09-04 10:16

Commit message
fix: make install on a Mac names the native target, which is the only one that builds

MUX_TARGET spelled `aarch64-macos` on Darwin, and that target does not
compile: zig 0.15.2 discovers the macOS SDK by running `xcrun
--show-sdk-path` — the very question deps/mac-sdk.sh's shim exists to
answer — only when the target is NATIVE. Naming the machine explicitly
makes it a cross-compile with no system include path, so the @cImport of
<util.h> in both os_macos arms fails with "file not found" and `make
install` cannot produce a binary at all. Measured on squirtle: native and
-Dtarget=native both build, -Dtarget=aarch64-macos fails with 4 errors.

Nothing had run `make install` on a Mac before — test/mac.sh builds,
checks and tests there but installs into a guest by scp — so the gate
that found this is test/xos.sh, whose Linux→Mac legs need a mux at
~/.local/bin where an ssh handoff's appended PATH looks for one.

The same leg stops isolating XDG_CACHE_HOME around the two makes: zig's
global package cache lives under it, so a fresh one re-fetches ghostty and
the whole package set every run.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SakwJEwD9dXBoRP5kWbemW

Makefile
Old New
@@ -6,10 +6,19 @@ ZIG ?= $(CURDIR)/deps/zig/zig
6 # deps/mac-sdk.sh). The shim dir goes FIRST on PATH for every recipe here, 6 # deps/mac-sdk.sh). The shim dir goes FIRST on PATH for every recipe here,
7 # and `mac-sdk` builds it; both are no-ops on Linux and on a Mac whose SDK 7 # and `mac-sdk` builds it; both are no-ops on Linux and on a Mac whose SDK
8 # is linkable. MUX_TARGET follows the host: a Mac installs a Mac binary. 8 # is linkable. MUX_TARGET follows the host: a Mac installs a Mac binary.
9 #
10 # `native` and NOT `aarch64-macos`, which names the same machine and does
11 # not build. zig 0.15.2 looks for the macOS SDK — by running `xcrun
12 # --show-sdk-path`, which is exactly what the shim above answers — only for
13 # a NATIVE target; an explicitly named one is a cross-compile and gets no
14 # system include path at all, so `@cImport` of <util.h> (forkpty's header,
15 # which lives in the SDK) fails with "file not found" and `make install` on
16 # a Mac cannot produce a binary. Found by test/xos.sh, which is the first
17 # thing in the tree to run `make install` on Darwin.
9 UNAME_S := $(shell uname -s) 18 UNAME_S := $(shell uname -s)
10 ifeq ($(UNAME_S),Darwin) 19 ifeq ($(UNAME_S),Darwin)
11 export PATH := $(CURDIR)/deps/mac-sdk/bin:/opt/homebrew/bin:$(PATH) 20 export PATH := $(CURDIR)/deps/mac-sdk/bin:/opt/homebrew/bin:$(PATH)
12 MUX_TARGET ?= aarch64-macos 21 MUX_TARGET ?= native
13 endif 22 endif
14 MUX_TARGET ?= x86_64-linux-musl 23 MUX_TARGET ?= x86_64-linux-musl
15 24
test/xos.sh
Old New
@@ -207,8 +207,14 @@ ok push "$MAC:$REPO on $BRANCH at $(git rev-parse --short HEAD), pushed=$PUSHED"
207 # handoff's appended PATH finds it. The shim PATH is required for the link 207 # handoff's appended PATH finds it. The shim PATH is required for the link
208 # and Homebrew is not on a non-interactive PATH, so both are spelled here. 208 # and Homebrew is not on a non-interactive PATH, so both are spelled here.
209 leg 209 leg
210 # XDG_CACHE_HOME back to the Mac's own for these two: zig's GLOBAL package
211 # cache lives under it, and building into a fresh one re-fetches ghostty and
212 # the rest of the package set on every run — minutes, for isolation this leg
213 # does not need. What the prelude isolates is mux's own cache directory, and
214 # no mux runs here.
210 BOUT=$(mssh 2400 <<H 215 BOUT=$(mssh 2400 <<H
211 cd \$HOME/$REPO || { echo "RC_BUILD=90"; exit 0; } 216 cd \$HOME/$REPO || { echo "RC_BUILD=90"; exit 0; }
217 unset XDG_CACHE_HOME
212 export PATH=\$HOME/$REPO/deps/mac-sdk/bin:/opt/homebrew/bin:\$PATH 218 export PATH=\$HOME/$REPO/deps/mac-sdk/bin:/opt/homebrew/bin:\$PATH
213 make build >/tmp/xos-build.log 2>&1; echo "RC_BUILD=\$?" 219 make build >/tmp/xos-build.log 2>&1; echo "RC_BUILD=\$?"
214 make install >/tmp/xos-install.log 2>&1; echo "RC_INSTALL=\$?" 220 make install >/tmp/xos-install.log 2>&1; echo "RC_INSTALL=\$?"