From a2945091dca4a6d8f94ebcfaa86bc41e848bb99c Mon Sep 17 00:00:00 2001 From: Evan Wilde Date: Mon, 20 Oct 2025 09:34:56 -0700 Subject: [PATCH 1/2] Windows: Pass full triple to Swift `CMAKE_Swift_COMPILER_TARGET` takes the full target triple, not the module triple. This probably doesn't affect Windows, but will/does affect availability on Android resulting in Foundation failing to build due to `error: 'getgrnam_r' is only available in Android 24 or newer`. --- utils/build.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/build.ps1 b/utils/build.ps1 index 0c52d641b34bf..44287a3c1ed17 100644 --- a/utils/build.ps1 +++ b/utils/build.ps1 @@ -1662,7 +1662,7 @@ function Build-CMakeProject { } Add-KeyValueIfNew $Defines CMAKE_Swift_COMPILER $SWIFTC - Add-KeyValueIfNew $Defines CMAKE_Swift_COMPILER_TARGET (Get-ModuleTriple $Platform) + Add-KeyValueIfNew $Defines CMAKE_Swift_COMPILER_TARGET $Platform.Triple # TODO(compnerd): remove this once we have the early swift-driver Add-KeyValueIfNew $Defines CMAKE_Swift_COMPILER_USE_OLD_DRIVER "YES" @@ -1793,7 +1793,7 @@ function Build-CMakeProject { Join-Path -Path (Get-PinnedToolchainToolsDir) -ChildPath "swiftc.exe" } Add-KeyValueIfNew $Defines CMAKE_Swift_COMPILER $SWIFTC - Add-KeyValueIfNew $Defines CMAKE_Swift_COMPILER_TARGET (Get-ModuleTriple $Platform) + Add-KeyValueIfNew $Defines CMAKE_Swift_COMPILER_TARGET $Platform.Triple # TODO(compnerd) remove this once we have the early swift-driver Add-KeyValueIfNew $Defines CMAKE_Swift_COMPILER_USE_OLD_DRIVER "YES" @@ -2947,7 +2947,7 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa -Defines @{ BUILD_SHARED_LIBS = if ($Static) { "NO" } else { "YES" }; CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES"; - CMAKE_Swift_COMPILER_TARGET = (Get-ModuleTriple $Platform); + CMAKE_Swift_COMPILER_TARGET = $Platform.Triple; CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib"; SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore"; From e64ed3769a5a19fadf2e9b78ef4259b08017116a Mon Sep 17 00:00:00 2001 From: Evan Wilde Date: Mon, 20 Oct 2025 10:08:03 -0700 Subject: [PATCH 2/2] Windows: Volatile: Remove explicit triple `CMAKE_Swift_COMPILER_TARGET` is set up by `Build-CMakeProject`. We shouldn't need to pass it into the volatile build explicitly. --- utils/build.ps1 | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/build.ps1 b/utils/build.ps1 index 44287a3c1ed17..2a6359266491d 100644 --- a/utils/build.ps1 +++ b/utils/build.ps1 @@ -2947,7 +2947,6 @@ function Build-ExperimentalRuntime([Hashtable] $Platform, [switch] $Static = $fa -Defines @{ BUILD_SHARED_LIBS = if ($Static) { "NO" } else { "YES" }; CMAKE_FIND_PACKAGE_PREFER_CONFIG = "YES"; - CMAKE_Swift_COMPILER_TARGET = $Platform.Triple; CMAKE_STATIC_LIBRARY_PREFIX_Swift = "lib"; SwiftCore_DIR = "${RuntimeBinaryCache}\cmake\SwiftCore";