Skip to content

Conversation

@davidnguyen-tech
Copy link
Member

@davidnguyen-tech davidnguyen-tech commented Feb 10, 2026

Summary

Replace CMAKE_OSX_DEPLOYMENT_TARGET=17.0 with CMAKE_OSX_DEPLOYMENT_TARGET=14.0 in the maccatalyst cmake args in eng/native/build-commons.sh.

Problem

Building for maccatalyst fails on Xcode 26.2 with:

clang: error: invalid version number in '-mmacosx-version-min=17.0'

The build sets CMAKE_SYSTEM_NAME=Darwin with CMAKE_OSX_SYSROOT=macosx, so CMake interprets CMAKE_OSX_DEPLOYMENT_TARGET=17.0 as a macOS deployment target and emits -mmacosx-version-min=17.0. But 17.0 is 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, before configurecompiler.cmake can apply the correct -target arm64-apple-ios17.0-macabi triple.

Fix

Change CMAKE_OSX_DEPLOYMENT_TARGET from 17.0 (Catalyst version) to 14.0 (the equivalent macOS version). CMake uses this value only for its initial compiler test (-mmacosx-version-min), and 14.0 is a valid macOS version that clang accepts. The effective Catalyst minimum version is enforced separately via the hardcoded -target *-apple-ios17.0-macabi triple in eng/native/configurecompiler.cmake.

Validation

Full clr+clr.runtime+libs+packs build for maccatalyst-arm64 succeeds with this change on Xcode 26.2 / CMake 4.2.0.

Copilot AI review requested due to automatic review settings February 10, 2026 13:26
@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Feb 10, 2026
@davidnguyen-tech
Copy link
Member Author

/azp run runtime-extra-platforms

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@davidnguyen-tech davidnguyen-tech added os-maccatalyst MacCatalyst OS and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Feb 10, 2026
Copy link
Contributor

Copilot AI left a 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.0 from the maccatalyst CMake args so CMake’s compiler test uses a valid macOS min-version.
  • Keep Mac Catalyst targeting driven by the explicit *-apple-ios17.0-macabi target triple applied later by configurecompiler.cmake.

@davidnguyen-tech davidnguyen-tech changed the title Fix maccatalyst native build failure on Xcode 26.2 [maccatalyst][coreclr] Fix native build failure on Xcode 26.2 Feb 10, 2026
@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Feb 10, 2026
@davidnguyen-tech
Copy link
Member Author

/azp run runtime-extra-platforms

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@davidnguyen-tech
Copy link
Member Author

/azp run runtime-extra-platforms

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@davidnguyen-tech davidnguyen-tech added area-Infrastructure-coreclr and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Feb 10, 2026
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @agocke, @dotnet/runtime-infrastructure
See info in area-owners.md if you want to be subscribed.

@kotlarmilos
Copy link
Member

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?

@davidnguyen-tech
Copy link
Member Author

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.
@davidnguyen-tech davidnguyen-tech force-pushed the fix-maccatalyst-cmake-deployment-target branch from ab3a640 to 6d80c01 Compare February 11, 2026 11:26
Copilot AI review requested due to automatic review settings February 11, 2026 11:26
@davidnguyen-tech
Copy link
Member Author

/azp run runtime-extra-platforms

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

Copilot AI left a 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"
Copy link
Member

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

# 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
it should result in some default value (which gets overridden by the -target)

Copy link
Member Author

@davidnguyen-tech davidnguyen-tech Feb 12, 2026

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

4 participants