-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[maccatalyst][coreclr] Fix native build failure on Xcode 26.2 #124220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[maccatalyst][coreclr] Fix native build failure on Xcode 26.2 #124220
Conversation
|
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Removes an invalid macOS deployment target setting from the Mac Catalyst native CMake configuration to unblock builds on Xcode 26.2, where clang now hard-errors on -mmacosx-version-min=17.0.
Changes:
- Drop
-DCMAKE_OSX_DEPLOYMENT_TARGET=17.0from themaccatalystCMake args so CMake’s compiler test uses a valid macOS min-version. - Keep Mac Catalyst targeting driven by the explicit
*-apple-ios17.0-macabitarget triple applied later byconfigurecompiler.cmake.
|
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Tagging subscribers to this area: @agocke, @dotnet/runtime-infrastructure |
|
Thanks @davidnguyen-tech. Is this failure encountered in the dotnet/dotnet build? Having CMAKE_OSX_DEPLOYMENT_TARGET explicitly defined avoids unexpected behavior when the OS version changes. Could we set a new default minimum value? |
I haven't tried it in dotnet/dotnet yet - only in dotnet/runtime. Yes, setting a default minimum value makes sense. Thanks for suggestion. |
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.
ab3a640 to
6d80c01
Compare
|
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
| # 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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we can just remove CMAKE_OSX_DEPLOYMENT_TARGET, according to the comment in
runtime/eng/native/configurecompiler.cmake
Lines 711 to 715 in 92741be
| # Somewhere between CMake 3.17 and 3.19.4, it became impossible to not pass | |
| # a value for mmacosx-version-min (blank CMAKE_OSX_DEPLOYMENT_TARGET gets | |
| # replaced with a default value, and always gets expanded to an OS version. | |
| # https://gitlab.kitware.com/cmake/cmake/-/issues/20132 | |
| # We need to disable the warning that -target replaces -mmacosx-version-min |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we can, that was the original solution, but I set a default value explicitly based on this comment:
Having CMAKE_OSX_DEPLOYMENT_TARGET explicitly defined avoids unexpected behavior when the OS version changes.
#124220 (comment)
But if CMAKE_OSX_DEPLOYMENT_TARGET doesn't really get consumed, we should be safe.
On the other hand, setting an explicit default is a more defensive choice.
What do you think?
Summary
Replace
CMAKE_OSX_DEPLOYMENT_TARGET=17.0withCMAKE_OSX_DEPLOYMENT_TARGET=14.0in the maccatalyst cmake args ineng/native/build-commons.sh.Problem
Building for maccatalyst fails on Xcode 26.2 with:
The build sets
CMAKE_SYSTEM_NAME=DarwinwithCMAKE_OSX_SYSROOT=macosx, so CMake interpretsCMAKE_OSX_DEPLOYMENT_TARGET=17.0as a macOS deployment target and emits-mmacosx-version-min=17.0. But17.0is a Mac Catalyst version number, not a macOS version. Older clang accepted this silently; Xcode 26.2's clang rejects it as a hard error during CMake's compiler test, beforeconfigurecompiler.cmakecan apply the correct-target arm64-apple-ios17.0-macabitriple.Fix
Change
CMAKE_OSX_DEPLOYMENT_TARGETfrom17.0(Catalyst version) to14.0(the equivalent macOS version). CMake uses this value only for its initial compiler test (-mmacosx-version-min), and14.0is a valid macOS version that clang accepts. The effective Catalyst minimum version is enforced separately via the hardcoded-target *-apple-ios17.0-macabitriple ineng/native/configurecompiler.cmake.Validation
Full
clr+clr.runtime+libs+packsbuild for maccatalyst-arm64 succeeds with this change on Xcode 26.2 / CMake 4.2.0.