SPB Git

spb/zyquo-mlx Public MIT

The local MLX foundry for your Mac — run, fine-tune, quantize, and ship models. Nothing leaves your machine.

Swift 93.4% Python 3.8% Makefile 2.2% Shell 0.5%

phase1: checkpoint — swiftbuild backend resolved (metallib OK), Makefile/BUILD.md updated, app assembled and launch-verified

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
simon-pierre boucher committed 11 days ago (Jul 30, 2026) parent 01a6fd9

Showing 3 changed files with +36 and −20

modified Makefile +7 −4
@@ -22,10 +22,13 @@ CONFIG ?= release
22 22 XCODE_DEV_DIR := /Applications/Xcode.app/Contents/Developer
23 23 DEV := DEVELOPER_DIR=$(XCODE_DEV_DIR)
24 24
25 # Build backend per docs/BUILD.md §3.1: try SwiftPM first (Swift 6.4 issues
26 # CompileMetalFile itself); fall back to xcodebuild if metallib is missing.
25 +# Build backend per docs/BUILD.md §3.1 (RESOLVED 2026-07-30): the new
26 +# SwiftPM backend (--build-system swiftbuild, Swift 6.4) compiles the Metal
27 +# kernels and emits mlx-swift_Cmlx.bundle/default.metallib. The classic
28 +# backend silently skips Metal → broken GPU path. xcodebuild kept as fallback.
27 29 BUILD_DIR := .build
28 BIN_DIR = $(BUILD_DIR)/$(CONFIG)
30 +CONFIG_TITLE = $(shell echo $(CONFIG) | awk '{print toupper(substr($$0,1,1)) substr($$0,2)}')
31 +BIN_DIR = $(BUILD_DIR)/out/Products/$(CONFIG_TITLE)
29 32
30 33 .PHONY: build build-xcodebuild app dev run icon clean release check-toolchain
31 34
@@ -33,7 +36,7 @@ check-toolchain:
33 36 @test -d $(XCODE_DEV_DIR) || { echo "error: Xcode toolchain not found at /Applications/Xcode.app — see docs/BUILD.md §2"; exit 1; }
34 37
35 38 build: check-toolchain
36 $(DEV) swift build -c $(CONFIG)
39 + $(DEV) swift build --build-system swiftbuild -c $(CONFIG)
37 40
38 41 build-xcodebuild: check-toolchain
39 42 $(DEV) xcodebuild build \
modified docs/BUILD.md +12 −7
@@ -112,13 +112,18 @@ xcodebuild build \
112 112 (SPM package schemes are auto-generated from `Package.swift` — no
113 113 `.xcodeproj` is ever created by hand.)
114 114
115 **Also try at Phase 1:** plain `swift build -c release` with
116 `DEVELOPER_DIR` pointing at Xcode. Local evidence shows Swift 6.4's SwiftPM
117 (new swift-build backend) issues `CompileMetalFile` steps itself, so with the
118 Metal toolchain installed it may now build the metallib end-to-end
119 (*UNVERIFIED until the toolchain is installed — mlx-swift's README statement
120 predates Swift 6.4*). If it works, prefer `swift build` (simpler paths);
121 keep `xcodebuild` as the documented fallback. Record the outcome here.
115 +**RESOLVED (tested 2026-07-30, Xcode 26.6 + Metal toolchain 17F109):**
116 +
117 +- Classic backend `swift build -c release`: compiles and links fine but
118 + **silently skips Metal** — no `default.metallib`, no `mlx-swift_Cmlx.bundle`
119 + → broken GPU path at runtime. Do not use.
120 +- **New backend `swift build --build-system swiftbuild -c release`: fully
121 + works** — compiles all `.metal` kernels and emits
122 + `.build/out/Products/Release/mlx-swift_Cmlx.bundle/Contents/Resources/default.metallib`
123 + plus the other resource bundles, 0 warnings, ~90 s clean build.
124 + **This is the primary build command** (encoded in the Makefile);
125 + `xcodebuild` remains the documented fallback above. Products land in
126 + `.build/out/Products/{Release|Debug}/`.
122 127
123 128 ### 3.2 Assembling `Zyquo MLX.app` (Makefile)
124 129
modified docs/PLAN.md +17 −9
@@ -65,16 +65,24 @@ Metal kernel compilation → strategy: full Xcode as toolchain, CLI-only builds,
65 65
66 66 ---
67 67
68 ## Phase 1 — Project Setup (in progress)
68 +## Phase 1 — Project Setup ✅ (completed 2026-07-30)
69 69
70 - [ ] Xcode toolchain provisioned (CLI-only; Metal toolchain component) — download in progress
71 - [ ] `Package.swift` — target `ZyquoMLX`, deps per MLX-RESEARCH.md §8
72 - [ ] `Makefile` — build / app / dev / icon / clean (+ release stub for Phase 8)
73 - [ ] `Info.plist` — Zyquo MLX, com.zyquo.mlx, macOS 14+, arm64, developer-tools
74 - [ ] `@main` SwiftUI entry point + Apple-Silicon gate + terminal activation
75 - [ ] Python bootstrap plan wired (first-run venv per BUILD.md §3.4 — code lands Phase 3)
76 - [ ] `README.md` (build instructions)
77 - [ ] Phase checkpoint: `swift build`/`xcodebuild` green, app launches, zero warnings
70 +- [x] Xcode 26.6 toolchain provisioned (CLI-only; Metal toolchain 17F109 installed)
71 +- [x] `Package.swift` — target `ZyquoMLX`, deps per MLX-RESEARCH.md §8 (resolve exact: mlx-swift 0.31.6, mlx-swift-lm 3.31.4, swift-transformers 1.3.3, swift-huggingface 0.9.0)
72 +- [x] `Makefile` — build / app / dev / run / icon / clean (+ release stub for Phase 8)
73 +- [x] `Info.plist` — Zyquo MLX, com.zyquo.mlx, macOS 14+, arm64, developer-tools
74 +- [x] `@main` SwiftUI entry point + Apple-Silicon gate + terminal activation
75 +- [x] Python bootstrap plan wired (first-run venv per BUILD.md §3.4 — code lands Phase 3)
76 +- [x] `README.md` (build instructions)
77 +- [x] Phase checkpoint: build green (0 warnings), `Zyquo MLX.app` assembled, launched, window verified by screenshot
78 +
79 +**Phase 1 summary:** Xcode 26.6 installed as toolchain-only; resolved the build
80 +definitively — classic SwiftPM silently skips Metal (broken GPU path), but
81 +`swift build --build-system swiftbuild -c release` compiles all kernels and
82 +emits `mlx-swift_Cmlx.bundle/default.metallib` (~90 s clean, 0 warnings), so
83 +no xcodebuild is needed. `make app` assembles an ad-hoc-signed `Zyquo MLX.app`
84 +with all resource bundles; app launches with the Apple-Silicon gate in place.
85 +BUILD.md §3.1 updated with the resolved recipe.
78 86 ## Phase 2 — Architecture + Inference POC (not started)
79 87 ## Phase 3 — Training, Quantization & Conversion (not started)
80 88 ## Phase 4 — Design System & UI (not started)
81 89