From 6d80c01440f09a094e57ef5837f66f6bb85eb19f Mon Sep 17 00:00:00 2001 From: David Nguyen <87228593+davidnguyen-tech@users.noreply.github.com> Date: Wed, 11 Feb 2026 12:26:23 +0100 Subject: [PATCH 1/2] Fix maccatalyst native build failure on Xcode 26.2 Use the macOS-equivalent deployment target (14.0) instead of the Catalyst version (17.0) for CMAKE_OSX_DEPLOYMENT_TARGET. CMake interprets this value as a macOS min-version since CMAKE_SYSTEM_NAME is Darwin, and newer clang rejects 17.0 as an invalid macOS version. The effective Catalyst minimum version is enforced separately via the -target triple in eng/native/configurecompiler.cmake. --- eng/native/build-commons.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/eng/native/build-commons.sh b/eng/native/build-commons.sh index bf86924ac52607..a825c8bd537c36 100755 --- a/eng/native/build-commons.sh +++ b/eng/native/build-commons.sh @@ -91,9 +91,11 @@ build_native() if [[ "$targetOS" == maccatalyst ]]; then cmakeArgs="-C $__RepoRootDir/eng/native/tryrun_ios_tvos.cmake $cmakeArgs" - # set default macCatalyst deployment target - # keep in sync with SetOSTargetMinVersions in the root Directory.Build.props - cmakeArgs="-DCMAKE_SYSTEM_NAME=Darwin -DCMAKE_OSX_SYSROOT=macosx -DCMAKE_SYSTEM_VARIANT=maccatalyst -DCMAKE_OSX_DEPLOYMENT_TARGET=17.0 $cmakeArgs" + # CMAKE_OSX_DEPLOYMENT_TARGET is set to the macOS equivalent (14.0) of the + # Catalyst min version (17.0) so CMake's compiler test emits a valid + # -mmacosx-version-min flag. The effective Catalyst min version is enforced + # via the -target triple in eng/native/configurecompiler.cmake, not this value. + cmakeArgs="-DCMAKE_SYSTEM_NAME=Darwin -DCMAKE_OSX_SYSROOT=macosx -DCMAKE_SYSTEM_VARIANT=maccatalyst -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 $cmakeArgs" fi if [[ "$targetOS" == android || "$targetOS" == linux-bionic ]]; then From 9f1bf51971e55a1368d98445a91c418b394c582e Mon Sep 17 00:00:00 2001 From: David Nguyen <87228593+davidnguyen-tech@users.noreply.github.com> Date: Tue, 17 Feb 2026 13:07:52 +0100 Subject: [PATCH 2/2] Address review notes Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- eng/native/build-commons.sh | 11 ++++++----- eng/native/configurecompiler.cmake | 2 ++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/eng/native/build-commons.sh b/eng/native/build-commons.sh index a825c8bd537c36..09d72c63e6ff70 100755 --- a/eng/native/build-commons.sh +++ b/eng/native/build-commons.sh @@ -91,11 +91,12 @@ build_native() if [[ "$targetOS" == maccatalyst ]]; then cmakeArgs="-C $__RepoRootDir/eng/native/tryrun_ios_tvos.cmake $cmakeArgs" - # CMAKE_OSX_DEPLOYMENT_TARGET is set to the macOS equivalent (14.0) of the - # Catalyst min version (17.0) so CMake's compiler test emits a valid - # -mmacosx-version-min flag. The effective Catalyst min version is enforced - # via the -target triple in eng/native/configurecompiler.cmake, not this value. - cmakeArgs="-DCMAKE_SYSTEM_NAME=Darwin -DCMAKE_OSX_SYSROOT=macosx -DCMAKE_SYSTEM_VARIANT=maccatalyst -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 $cmakeArgs" + # Intentionally do not set CMAKE_OSX_DEPLOYMENT_TARGET for maccatalyst here: + # - CMake interprets CMAKE_OSX_DEPLOYMENT_TARGET as a macOS minimum version + # instead of MacCatalyst, causing newer clang to reject it as invalid. + # - The effective Catalyst minimum version is enforced via the + # -target *-apple-ios-macabi flag in eng/native/configurecompiler.cmake + cmakeArgs="-DCMAKE_SYSTEM_NAME=Darwin -DCMAKE_OSX_SYSROOT=macosx -DCMAKE_SYSTEM_VARIANT=maccatalyst $cmakeArgs" fi if [[ "$targetOS" == android || "$targetOS" == linux-bionic ]]; then diff --git a/eng/native/configurecompiler.cmake b/eng/native/configurecompiler.cmake index 6b9ac068fd87c6..474402706f40ff 100644 --- a/eng/native/configurecompiler.cmake +++ b/eng/native/configurecompiler.cmake @@ -727,6 +727,8 @@ if (CLR_CMAKE_HOST_UNIX OR CLR_CMAKE_HOST_WASI) endif() endif() add_link_options(${DISABLE_OVERRIDING_MIN_VERSION_ERROR}) + # Keep the Catalyst version in the -target triples below in sync + # with MacCatalystVersionMin in SetOSTargetMinVersions in Directory.Build.props. if(CLR_CMAKE_HOST_ARCH_ARM64) set(CLR_CMAKE_MACCATALYST_COMPILER_TARGET "arm64-apple-ios17.0-macabi") add_link_options(-target ${CLR_CMAKE_MACCATALYST_COMPILER_TARGET})