Fix mac build

This commit is contained in:
popux committed 2026-10-22 16:24:11 +02:00
1 parent aa8c2754d9
commit dd88c8ee28
2 files changed
+22 -8

No files matched your search

+9 -7
View File
@@ -23,14 +23,15 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
# declaration (no members) and rejects base-member access. So prefer GCC.
# (GCC does hard-error on the one struct that declares a member with the same
# name as an inherited one — CCTVRecord's `pad` — see docs/internals.md.)
# An explicit -DCMAKE_C_COMPILER=... always wins.
if(NOT DEFINED CMAKE_C_COMPILER)
# An explicit -DCMAKE_C_COMPILER=... or a CC environment variable always wins.
if(NOT DEFINED CMAKE_C_COMPILER AND "$ENV{CC}" STREQUAL "")
if(CMAKE_HOST_APPLE)
# Homebrew installs real GNU GCC with a version suffix; /usr/bin/gcc is
# Apple Clang and does not support the Plan 9 struct extensions required
# by the decomp's `inherits` pattern.
# Homebrew (gcc-N) and MacPorts (gcc-mp-N) install real GNU GCC with a
# version suffix; /usr/bin/gcc is Apple Clang and does not support the
# Plan 9 struct extensions required by the decomp's `inherits` pattern.
find_program(_GE007_GCC
NAMES gcc-16 gcc-15 gcc-14 gcc-13 gcc-12 gcc-11 gcc)
NAMES gcc-16 gcc-mp-16 gcc-15 gcc-mp-15 gcc-14 gcc-mp-14 gcc-13 gcc-mp-13
gcc-12 gcc-mp-12 gcc-11 gcc-mp-11 gcc)
else()
find_program(_GE007_GCC NAMES gcc)
endif()
@@ -39,7 +40,8 @@ if(NOT DEFINED CMAKE_C_COMPILER)
get_filename_component(_GE007_GCC_DIR "${_GE007_GCC}" DIRECTORY)
if(CMAKE_HOST_APPLE)
find_program(_GE007_GXX
NAMES g++-16 g++-15 g++-14 g++-13 g++-12 g++-11 g++
NAMES g++-16 g++-mp-16 g++-15 g++-mp-15 g++-14 g++-mp-14 g++-13 g++-mp-13
g++-12 g++-mp-12 g++-11 g++-mp-11 g++
PATHS "${_GE007_GCC_DIR}" NO_DEFAULT_PATH)
else()
find_program(_GE007_GXX NAMES g++
+13 -1
View File
@@ -55,7 +55,19 @@ brew install cmake gcc sdl2 zlib python3
The project requires real GNU GCC for the decomp's Plan 9 struct extensions.
Apple's `/usr/bin/gcc` is Clang and is not compatible. CMake automatically
selects Homebrew's versioned `gcc-N`/`g++-N` executables.
selects Homebrew's versioned `gcc-N`/`g++-N` (or MacPorts' `gcc-mp-N`/`g++-mp-N`)
executables; set `CC`/`CXX` to pick a specific one. Delete the build directory
after switching compilers.
If GCC fails with `fatal error: _bounds.h: No such file or directory`, it was
built against a newer macOS SDK than the one CMake picked (the `xcode-select`
default). Point `SDKROOT` at the SDK GCC was built with (`gcc -v` shows it as
`--with-sysroot`), for example with MacPorts GCC 15:
```sh
SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk \
CC=/opt/local/bin/gcc-mp-15 CXX=/opt/local/bin/g++-mp-15 ./build-pc.sh ntsc-final
```
### Asset extraction (decompilation toolchain)