From f755dcfc1f66ea09eabf4ad9b473ba14f93f493f Mon Sep 17 00:00:00 2001 From: amaurybegood Date: Sun, 25 Oct 2026 17:37:47 +0100 Subject: [PATCH 1/2] macOS: pass explicit CMAKE_OSX_SYSROOT to the native configure Fixes #353 ## Problem On recent macOS versions, the CMake bundled in Setup.app fails to detect the SDK, leaving `CMAKE_OSX_SYSROOT` empty. Regular compile steps still work (clang falls back to the default SDK), but libpng's `genout.cmake` step only passes `-isysroot` when `CMAKE_OSX_SYSROOT` is set, so `pnglibconf.out` generation fails with: ``` fatal error: 'sys/types.h' file not found ``` ## Fix Resolve the SDK path explicitly and pass it to the native configure step, so the build no longer depends on the bundled CMake's SDK detection. Also fails early with a clear message if the SDK cannot be resolved. ## Testing Confirmed on MacBook Pro M1 (macOS 27.0.1): the workaround (setting `CMAKE_OSX_SYSROOT` manually) completes the build successfully; this PR bakes the same fix into the build script. --- Launcher/local-build-macos.command | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Launcher/local-build-macos.command b/Launcher/local-build-macos.command index 8a8679da6..7387055c5 100755 --- a/Launcher/local-build-macos.command +++ b/Launcher/local-build-macos.command @@ -64,7 +64,7 @@ done macos_arch=$(uname -m) case "$macos_arch" in arm64|x86_64) ;; *) fail "unsupported macOS architecture: $macos_arch" ;; esac macos_deployment_target=12.0 -workspace=$(cd "$workspace" && pwd) +macos_sysroot=$(xcrun --show-sdk-path 2>/dev/null) || fail 'could not resolve the macOS SDK; install the Xcode Command Line Tools (xcode-select --install)'workspace=$(cd "$workspace" && pwd) if [[ -z "$setup_version" && -f "$workspace/Launcher/Directory.Build.props" ]]; then setup_version=$(sed -nE 's/.*([^<]+)<\/Version>.*/\1/p' "$workspace/Launcher/Directory.Build.props" | head -n 1) fi @@ -186,7 +186,7 @@ fi step configure-native 'Configuring the native toolchain' # Use Aurora's pinned SDL3 source on macOS. A system SDL3 can be older than # Aurora's required API even when find_package() succeeds. -"$cmake_bin" -S "$workspace/runtime" -B "$native_build" -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$cc_bin" -DCMAKE_CXX_COMPILER="$cxx_bin" -DCMAKE_MAKE_PROGRAM="$ninja_bin" -DCMAKE_OSX_ARCHITECTURES="$macos_arch" -DCMAKE_OSX_DEPLOYMENT_TARGET="$macos_deployment_target" -DMKW_TRANSLATED_COMPILE_JOBS="$translated_jobs" -DMKW_X86_CPU_PROFILE="$x86_cpu_profile" -DAURORA_SDL3_PROVIDER=vendor -DMKW_SETUP_VERSION="$setup_version" +"$cmake_bin" -S "$workspace/runtime" -B "$native_build" -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$cc_bin" -DCMAKE_CXX_COMPILER="$cxx_bin" -DCMAKE_MAKE_PROGRAM="$ninja_bin" -DCMAKE_OSX_ARCHITECTURES="$macos_arch" -DCMAKE_OSX_DEPLOYMENT_TARGET="$macos_deployment_target" -DCMAKE_OSX_SYSROOT="$macos_sysroot" -DMKW_TRANSLATED_COMPILE_JOBS="$translated_jobs" -DMKW_X86_CPU_PROFILE="$x86_cpu_profile" -DAURORA_SDL3_PROVIDER=vendor -DMKW_SETUP_VERSION="$setup_version" mkw_write_identity "$toolchain_provenance" ToolchainFingerprint "$toolchain_fingerprint" targets=(); [[ "$profile" != retro-rewind ]] && targets+=(WiiCompiled); [[ "$profile" != base ]] && targets+=(RetroRewind) step compile "Compiling ${targets[*]} locally"; "$cmake_bin" --build "$native_build" --target "${targets[@]}" --parallel "$global_jobs" From d96ce985cde1dd61745008c6ac29b1d39ec03705 Mon Sep 17 00:00:00 2001 From: patchzyy <64382339+patchzyy@users.noreply.github.com> Date: Mon, 26 Oct 2026 17:04:45 +0100 Subject: [PATCH 2/2] fix sysroot line and check sdk dir --- Launcher/local-build-macos.command | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Launcher/local-build-macos.command b/Launcher/local-build-macos.command index 7387055c5..847443d35 100755 --- a/Launcher/local-build-macos.command +++ b/Launcher/local-build-macos.command @@ -64,7 +64,8 @@ done macos_arch=$(uname -m) case "$macos_arch" in arm64|x86_64) ;; *) fail "unsupported macOS architecture: $macos_arch" ;; esac macos_deployment_target=12.0 -macos_sysroot=$(xcrun --show-sdk-path 2>/dev/null) || fail 'could not resolve the macOS SDK; install the Xcode Command Line Tools (xcode-select --install)'workspace=$(cd "$workspace" && pwd) +macos_sysroot=$(xcrun --show-sdk-path 2>/dev/null) && [[ -d "$macos_sysroot" ]] || fail 'could not resolve the macOS SDK; install the Xcode Command Line Tools (xcode-select --install)' +workspace=$(cd "$workspace" && pwd) if [[ -z "$setup_version" && -f "$workspace/Launcher/Directory.Build.props" ]]; then setup_version=$(sed -nE 's/.*([^<]+)<\/Version>.*/\1/p' "$workspace/Launcher/Directory.Build.props" | head -n 1) fi