Fix building from source on Apple Silicon (arm64) and recent Clang#107
Fix building from source on Apple Silicon (arm64) and recent Clang#107M-RR-J wants to merge 1 commit into
Conversation
|
Follow-up validation. I've now put this build under real load, well beyond the 50-step smoke test above. Same setup (M1 Max, macOS, Python 3.12, AppleClang 21, Qt 5.15):
So the source build isn't just importable — it holds up under sustained, high-throughput training on Apple Silicon. |
…le fix Two new rl-from-scratch posts: - 2026-07-06 "From Mario to Procgen" — preprocessing, the emulator/process tax (8→64 envs), and the train/test generalization split, with rendered Mario/Procgen frames. - 2026-07-07 "The last mile was a compiler flag" — the arm64 build fix upstreamed as openai/procgen#107 (closes #69), validated at 100M steps. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
@hintz-openai (cc @christopher-hesse ) — apologies for the direct ping. This PR restores building procgen from source on Apple Silicon (arm64) + recent AppleClang, which currently fails outright. The change is small and behavior-preserving (an -march guard, an Apple-Silicon Homebrew Qt path, and two [[maybe_unused]] markers — no game-logic or determinism changes), and it's verified end-to-end on an M1 including a full 100M-step training run. It's mergeable with no conflicts. Would one of you be able to take a look, or point me to whoever currently maintains the repo? Happy to make any changes you'd like. Thanks! |
Closes #69.
Summary
procgencurrently fails to build from source on Apple Silicon (arm64) and on recentXcode / AppleClang. This PR restores the source build with a small, behavior-preserving change
set. Verified end-to-end on an M1: CoinRun creates and steps, observations are the expected
(N, 64, 64, 3)uint8 with a 15-action discrete space.Root causes & fixes
-march=ivybridgeis x86-only.procgen/CMakeLists.txtpasses-march=ivybridgeforpackaged builds; that is an Intel microarchitecture and arm64 Clang rejects it outright. Guard
it by architecture and use
-march=armv8-aonarm64/aarch64.procgen/builder.pyhardcodes/usr/local/opt/qt5/.... Apple Silicon Homebrew installs under/opt/homebrew, so also probe/opt/homebrew/opt/qt@5/lib/cmake. (PROCGEN_CMAKE_PREFIX_PATHstill overrides everything.)-Wunused-but-set-variablewarnings become errors under-Werror. AppleClang 21promotes two
set-but-unusedlocals instarpilot.cppandchaser.cppto hard errors. Markthem
[[maybe_unused]]— no game logic changes, determinism preserved.Testing
Built and ran on:
brew install qt@5).ProcgenGym3Env(num=2, env_name="coinrun")→ obs(2, 64, 64, 3)uint8, action spaceD15,stepped 50× with no errors.
Build prerequisites on Apple Silicon (workflow otherwise unchanged):
brew install qt@5 pip install -e .Scope / notes
-marchchange only affects packaged arm64 builds; the[[maybe_unused]]markers do not alter any game logic.cibuildwheelmatrix inprocgen-build/. That needs arm64 CI runners and an arm64 Qt build inCI, which I could not validate locally. This PR restores building from source; a wheels PR
can follow.