Repository navigation
Description
Description
Fresh CoreCLR CMake configurations fail with Xcode 27 because the PAL's check_function_exists(pipe2 HAVE_PIPE2) detects the newly declared pipe2 symbol without accounting for its deployment-target availability. The resulting build defines HAVE_PIPE2=1 while targeting macOS 14.0.
Reproduction Steps
With Xcode 27 selected, run a fresh build that compiles the macOS host-side PAL, for example:
PATH="/opt/homebrew/bin:$PATH" ./build.sh clr -os browser -arch wasm -c ReleaseThe generated compile command contains:
-DHAVE_PIPE2=1 -mmacosx-version-min=14.0 -Werror
Expected behavior
The availability probe should determine that pipe2 cannot be called when targeting macOS 14.0. HAVE_PIPE2 should remain disabled and the existing pipe plus fcntl(FD_CLOEXEC) fallback should compile.
Actual behavior
Compilation of src/coreclr/pal/src/thread/threadsusp.cpp fails:
error: 'pipe2' is only available on macOS 27.0 or newer
[-Werror,-Wunguarded-availability-new]
Xcode 27's SDK declares:
__API_AVAILABLE(macos(27.0), ios(27.0), tvos(27.0), watchos(27.0), visionos(27.0))
int pipe2(int [2], int);The current symbol/link probe succeeds because the SDK exports the symbol, but it does not verify usability at CMAKE_OSX_DEPLOYMENT_TARGET=14.0 with availability diagnostics enabled.
Regression?
Yes, this is exposed by Xcode 27 / macOS SDK 27. Older SDKs did not declare pipe2, so fresh configurations selected the fallback. Existing worktrees configured before an Xcode update may also retain HAVE_PIPE2=0 in their CMake cache and continue to build.
Known Workarounds
Use a worktree configured with an older SDK, or locally force HAVE_PIPE2=0. Neither is suitable for CI or normal development.
Configuration
- macOS arm64
- Xcode 27.0, build 27A266a
- macOS SDK 27.0
- Apple clang 21.0.0
- CoreCLR host deployment target: macOS 14.0
Other information
The fix should make the feature test deployment-target-aware rather than hardcoding an Xcode version. For example, compile a source snippet that calls pipe2 using the configured deployment target and treats -Wunguarded-availability-new as an error. This should leave HAVE_PIPE2=0 when the target predates the API.
Note
This issue was generated with the assistance of GitHub Copilot.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
Fix pipe2 detection for Apple deployment targets (#134028)
Fix pipe2 detection for Apple deployment targets (dotnet#134028)