Pull requests / #3405
#3405 [Other] macOS setup: install cmake and ninja before a compile
open · @Flo5k5 · 0 コメント · GitHub で見る
Setup & installAMD / HIPNVIDIA / CUDAModels & quantsDocumentation
本文
## Problem and result Fixes #3403. Since a242537 moved `cmake` and `ninja` to `requirements-build.txt`, `./setup.sh` on a Mac no longer installs them: `metal/setup_mac.py` still installs only `requirements.txt` and expects the build tools to come with it. On a fresh `.venv` without `ninja` on `PATH`, the Metal engine build stops at CMake's `'ninja' '--version'`. With this change, the engine and image encoder builds install the missing pinned helpers from `requirements-build.txt` into `.venv` first, and then build. ## Related discussion #3403 (focused fix, no change of defaults) ## Approach `build_tools()` in `metal/setup_mac.py` does what `setup.py`'s `cmake_build()` already does on a PC: it looks for each helper on `PATH` or next to the venv's Python (`find_tool`), installs only the missing pins with `pip_install`, and fails with the same workaround message if they are still not there. It runs right before a compile (`build_engine`, `build_vision`), and not when the engine is current, so the runtime install stays free of the build helpers, as a242537 intended. A `cmake` or `ninja` already on `PATH` (Homebrew, for example) is used as before. The step 3 message, the module docstring and `docs/MAC.md` no longer say that step 3 installs cmake and ninja. ## Validation **Passed:** - `python -m unittest tools.test_setup_mac` on 3c316c7 (macOS 27.0.1, Python 3.15.0): 28 tests OK. The 4 new `BuildTools` tests check that a fresh venv gets both pins, that only the missing helper is installed, that `requirements.txt` carries neither, and that both builds call `build_tools()` before anything else. On 9ae93f7's `setup_mac.py`, 3 of them fail (no `build_tools`). - Apple M5 Pro, 64 GB, macOS 27.0.1, fresh checkouts with no `.venv`, `./setup.sh --update --yes` (`llama.cpp` and `metal-cpp` copied into `third_party/` from an existing checkout at the same pins, `STRATA_SETTINGS_FILE` and `--data-dir` pointed at a scratch folder): - 9ae93f7, `ninja` not on `PATH`, Homebrew `cmake` on `PATH`: fails, `build-metal/build.log` as in #3403 (`'ninja' '--version'` ... `no such file or directory`). - 0aa3c59 (this change before line wrapping), same `PATH`: step 4 installs `ninja==1.13.2` only and builds `build-metal/strata`. - 3c316c7 (this PR), `PATH` reduced to `/usr/bin:/bin:/usr/sbin:/sbin` plus a `python3` link, so neither `cmake` nor `ninja`: step 4 installs `cmake==4.4.3 ninja==1.13.2` and builds `build-metal/strata`. A second run reports `Metal engine: ... (built for this source)` and installs nothing. **Failed:** None observed. **Not run:** - `build_vision()` on hardware: `--update` returns before the image encoder step. Only the unit test covers its call to `build_tools()`. - The full setup (model download, pack, start): unchanged by this PR and not needed for the failure. - CUDA, HIP and SYCL builds: not touched (only `metal/setup_mac.py`, `tools/test_setup_mac.py` and `docs/MAC.md` change). ## Limits An older `.venv` that already has cmake and ninja behaves as before. The desktop app's Control mode does not run `setup_mac.py` (its test asserts it), so it is not affected.
関連リンク
インストール・モデル・リリースへのサイト内リンク。