ref:0ed4a824edd8f3a14b044aca76fdd3b6f9337c97

Provide macOS SDK for the apple cross-build (#26)

The first run of this branch failed: cargo-zigbuild can't cross-link the *-apple-darwin targets on the Linux runner because zig bundles glibc/musl but NOT Apple's non-redistributable libSystem/frameworks. std + iana-time-zone (via chrono) link CoreFoundation, so a macOS SDK is required (rustls only removed the Security framework, not the SDK dependency — the earlier "no SDK needed" claim was wrong). Fetch a pinned macOS SDK (joseluisq/macosx-sdks 12.3, immutable release asset) and point cargo-zigbuild at it via SDKROOT before the apple builds; set MACOSX_DEPLOYMENT_TARGET=11.0 for a Big Sur floor. Also add the macos binaries to the CI artifacts list. Closes #26 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
SHA: 0ed4a824edd8f3a14b044aca76fdd3b6f9337c97
Author: CI <ci@anvil.test>
Date: 2026-07-13 01:49
Parents: 6716058
2 files changed +27 -5
Type
.anvil.yml +4 −0
@@ -75,3 +75,7 @@
path: runner-dist/anvil_linux_arm64
- name: anvil_linux_amd64
path: runner-dist/anvil_linux_amd64
- name: anvil_macos_arm64
path: runner-dist/anvil_macos_arm64
- name: anvil_macos_amd64
path: runner-dist/anvil_macos_amd64
ci/build-runner.sh +23 −5
@@ -63,12 +63,30 @@
cargo zigbuild --release --target "aarch64-unknown-linux-gnu.${GLIBC_FLOOR}" 2>&1
echo "==> Building linux amd64 (glibc $GLIBC_FLOOR floor)..."
cargo zigbuild --release --target "x86_64-unknown-linux-gnu.${GLIBC_FLOOR}" 2>&1
# macOS targets: no glibc floor (Apple libSystem, not glibc). The CLI is pure
# rustls (reqwest rustls-tls, default-features=false — no native-tls/Security
# framework), so zig's bundled macOS libc links it without a full Xcode SDK.
echo "==> Building macos arm64..."
# macOS targets: no glibc floor (Apple libSystem, not glibc). zig bundles
# glibc/musl but NOT Apple's (non-redistributable) libSystem + frameworks, so
# cross-linking against Darwin frameworks needs a macOS SDK — cargo-zigbuild
# finds it via SDKROOT (auto-detected on macOS, but this runner is Linux).
# Dropping native-tls for rustls removed the Security framework, but std +
# iana-time-zone (via chrono) still link CoreFoundation, so the SDK is required.
# Pinned, immutable SDK release asset; extracts to /opt/MacOSX${VER}.sdk.
MACOS_SDK_VERSION=12.3
MACOS_SDK_DIR="/opt/MacOSX${MACOS_SDK_VERSION}.sdk"
if [ ! -d "$MACOS_SDK_DIR" ]; then
echo "==> Fetching macOS SDK $MACOS_SDK_VERSION"
curl -sSL "https://github.com/joseluisq/macosx-sdks/releases/download/${MACOS_SDK_VERSION}/MacOSX${MACOS_SDK_VERSION}.sdk.tar.xz" \
-o /tmp/macos-sdk.tar.xz
mkdir -p /opt
tar -xJf /tmp/macos-sdk.tar.xz -C /opt
fi
export SDKROOT="$MACOS_SDK_DIR"
# Link against an older Darwin so the binaries run on macOS 11+ (Big Sur), not
# just the SDK's own version.
export MACOSX_DEPLOYMENT_TARGET=11.0
echo "==> Building macos arm64 (SDK $MACOS_SDK_VERSION)..."
cargo zigbuild --release --target aarch64-apple-darwin 2>&1
echo "==> Building macos amd64 (SDK $MACOS_SDK_VERSION)..."
echo "==> Building macos amd64..."
cargo zigbuild --release --target x86_64-apple-darwin 2>&1
ARM64_BIN="target/aarch64-unknown-linux-gnu/release/anvil"