Skip to content

build.ps1: Build the Android SDKs for API 24 instead#86957

Merged
finagolfin merged 1 commit into
swiftlang:mainfrom
finagolfin:droid24
Mar 17, 2026
Merged

build.ps1: Build the Android SDKs for API 24 instead#86957
finagolfin merged 1 commit into
swiftlang:mainfrom
finagolfin:droid24

Conversation

@finagolfin
Copy link
Copy Markdown
Member

Let's see if this passes all Windows CI. I'm putting together a pull next for the official Android CI that generates the SDK bundles, which runs on linux, but @marcprux already tested this out there months ago, swiftlang/swift-docker#509, and we've since added the posix_spawn changes that he was stubbing out back then.

This is based on @compnerd and other workgroup members' go-ahead in the latest Android workgroup meeting and the work @madsodgaard has been doing to drive this minimum API down to 24 and below.

@finagolfin finagolfin requested a review from compnerd as a code owner February 3, 2026 10:36
@finagolfin
Copy link
Copy Markdown
Member Author

@swift-ci test windows

@finagolfin
Copy link
Copy Markdown
Member Author

Hmm, looks like neither the Windows PR test or toolchain CI build the Android SDKs, so this can't be tested until after it's merged onto the main branch and run through the main "package" toolchain CI, which both builds and tests the Android SDKs on Windows.

Maybe we can extend the PR toolchain CI to at least build the Android SDKs also? Otherwise, it would be useful to add a swift-ci trigger to be able to invoke the main package toolchain CI too, just as we can for the PR toolchain CI.

@compnerd
Copy link
Copy Markdown
Member

compnerd commented Feb 3, 2026

Please test this locally before merging. Alternatively, I believe that @justice-adams-apple is working on getting some additional testing for Android configured, and could wait for that.

Comment thread utils/build.ps1
@finagolfin
Copy link
Copy Markdown
Member Author

Please test this locally before merging.

I haven't used Windows in more than a decade, so won't be me testing this. @Steelskin, any Windows BCNY CI that builds the Android SDKs that you can run this pull through?

@justice-adams-apple, are you working on further testing for Android on Windows or on linux? If linux only, it would be useful to have a manual CI trigger for the main Windows toolchain CI, which appears to be the only official swift.org CI that currently builds these Android SDKs on Windows.

Comment thread utils/build.ps1
@Steelskin
Copy link
Copy Markdown
Contributor

I haven't used Windows in more than a decade, so won't be me testing this. @Steelskin, any Windows BCNY CI that builds the Android SDKs that you can run this pull through?

I ran your changes through our CI and it passed our Android smoke test.

@compnerd
Copy link
Copy Markdown
Member

compnerd commented Feb 4, 2026

I haven't used Windows in more than a decade, so won't be me testing this. @Steelskin, any Windows BCNY CI that builds the Android SDKs that you can run this pull through?

I ran your changes through our CI and it passed our Android smoke test.

I'm not sure how the CI run helps here - that doesn't use build.ps1 and so it would continue to build at the same API level. The need here is to run a manual test so that we do not break swift.org CI.

@Steelskin
Copy link
Copy Markdown
Contributor

Steelskin commented Feb 4, 2026

I'm not sure how the CI run helps here - that doesn't use build.ps1 and so it would continue to build at the same API level. The need here is to run a manual test so that we do not break swift.org CI.

You're right. I clearly need more coffee. Sorry @finagolfin I guess you'll have to run it yourself. I'll do another run where I change the Android version on our build.

@Steelskin
Copy link
Copy Markdown
Contributor

Interestingly, changing the Android API level to 24 triggered a compiler crash on our CI while building the experimental Static Overlay on all 4 android architectures. This is not happening on trunk so it is something specific to using Android 24.

[12/13] Building Swift object Cxx/std/CxxStdlib.swiftmodule Cxx/std/CMakeFiles/swiftCxxStdlib.dir/std.swift.o Cxx/std/CMakeFiles/swiftCxxStdlib.dir/Chrono.swift.o Cxx/std/CMakeFiles/swiftCxxStdlib.dir/String.swift.o
FAILED: Cxx/std/CxxStdlib.swiftmodule Cxx/std/CMakeFiles/swiftCxxStdlib.dir/std.swift.o Cxx/std/CMakeFiles/swiftCxxStdlib.dir/Chrono.swift.o Cxx/std/CMakeFiles/swiftCxxStdlib.dir/String.swift.o 
D:\r\_work\swift-build\swift-build\BinaryCache\Library\Developer\Toolchains\0.0.0+Asserts\usr\bin\swiftc.exe -target aarch64-unknown-linux-android24 -j 16 -num-threads 16 -c -DSWIFT_STDLIB_HAS_COMMANDLINE -parse-as-library -static -emit-module -emit-module-path Cxx\std\CxxStdlib.swiftmodule -module-name CxxStdlib -module-link-name swiftCxxStdlib -Xclang-linker -target -Xclang-linker aarch64-unknown-linux-android24 -Xclang-linker --sysroot -Xclang-linker C:/Users/runner/.setup-ndk/r27c/toolchains/llvm/prebuilt/windows-x86_64/sysroot -Xclang-linker -resource-dir -Xclang-linker C:/Users/runner/.setup-ndk/r27c/toolchains/llvm/prebuilt/windows-x86_64/lib/clang/18 -g -O -swift-version 5 -incremental -Xfrontend -define-availability -Xfrontend "SwiftStdlib 9999:macOS 9999, iOS 9999, watchOS 9999, tvOS 9999" -Xfrontend -define-availability -Xfrontend "SwiftStdlib 5.0:macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2" -Xfrontend -define-availability -Xfrontend "SwiftStdlib 5.1:macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0" -Xfrontend -define-availability -Xfrontend "SwiftStdlib 5.2:macOS 10.15.4, iOS 13.4, watchOS 6.2, tvOS 13.4" -Xfrontend -define-availability -Xfrontend "SwiftStdlib 5.3:macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0" -Xfrontend -define-availability -Xfrontend "SwiftStdlib 5.4:macOS 11.3, iOS 14.5, watchOS 7.4, tvOS 14.5" -Xfrontend -define-availability -Xfrontend "SwiftStdlib 5.5:macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0" -Xfrontend -define-availability -Xfrontend "SwiftStdlib 5.6:macOS 12.3, iOS 15.4, watchOS 8.5, tvOS 15.4" -Xfrontend -define-availability -Xfrontend "SwiftStdlib 5.7:macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0" -Xfrontend -define-availability -Xfrontend "SwiftStdlib 5.8:macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4" -Xfrontend -define-availability -Xfrontend "SwiftStdlib 5.9:macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0" -Xfrontend -define-availability -Xfrontend "SwiftStdlib 5.10:macOS 14.4, iOS 17.4, watchOS 10.4, tvOS 17.4, visionOS 1.1" -Xfrontend -define-availability -Xfrontend "SwiftStdlib 6.0:macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0" -Xfrontend -define-availability -Xfrontend "SwiftStdlib 6.1:macOS 15.4, iOS 18.4, watchOS 11.4, tvOS 18.4, visionOS 2.4" -Xfrontend -define-availability -Xfrontend "SwiftStdlib 6.2:macOS 26.0, iOS 26.0, watchOS 26.0, tvOS 26.0, visionOS 26.0" -Xfrontend -define-availability -Xfrontend "SwiftStdlib 6.3:macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, visionOS 9999" -Xfrontend -define-availability -Xfrontend "SwiftStdlib 6.4:macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, visionOS 9999" -Xfrontend -define-availability -Xfrontend "SwiftCompatibilitySpan 5.0:macOS 10.14.4, iOS 12.2, watchOS 5.2, tvOS 12.2, visionOS 1.0" -Xfrontend -define-availability -Xfrontend "SwiftCompatibilitySpan 6.2:macOS 26.0, iOS 26.0, watchOS 26.0, tvOS 26.0, visionOS 26.0" -Xfrontend -define-availability -Xfrontend "Backtracing 6.2: macOS 26.0" -nostdlibimport -strict-memory-safety -Xfrontend -enable-lexical-lifetimes=false -Xfrontend -disable-implicit-concurrency-module-import -Xfrontend -disable-implicit-string-processing-module-import -Xfrontend -enforce-exclusivity=unchecked -Xfrontend -target-min-inlining-version -Xfrontend min -enable-experimental-feature NoncopyableGenerics2 -enable-experimental-feature SuppressedAssociatedTypes -enable-experimental-feature SE427NoInferenceOnExtension -enable-experimental-feature NonescapableTypes -enable-experimental-feature LifetimeDependence -enable-experimental-feature InoutLifetimeDependence -enable-experimental-feature LifetimeDependenceMutableAccessors -enable-upcoming-feature MemberImportVisibility -explicit-module-build -cxx-interoperability-mode=default -enable-experimental-feature AllowUnsafeAttribute -enable-experimental-feature Lifetimes -enable-experimental-feature AssumeResilientCxxTypes -disable-upcoming-feature MemberImportVisibility -Xfrontend -module-interface-preserve-types-as-written -Xfrontend -disable-module-selectors-in-module-interface -Xcc --sysroot -Xcc C:/Users/runner/.setup-ndk/r27c/toolchains/llvm/prebuilt/windows-x86_64/sysroot -emit-module-path D:/r/_work/swift-build/swift-build/BinaryCache/ExperimentalOverlay/Cxx/std/CxxStdlib.swiftmodule/aarch64-unknown-linux-android.swiftmodule -Xcc -fmodule-map-file=D:/r/_work/swift-build/swift-build/SourceCache/swift/Runtimes/Overlay/Cxx/cxxshim/libcxxshim.modulemap -Xcc -DSWIFT_STATIC_STDLIB -Xcc -fmodule-map-file=D:/r/_work/swift-build/swift-build/SourceCache/swift/Runtimes/Core/SwiftShims/swift/shims/module.modulemap -Xcc --sysroot=C:/Users/runner/.setup-ndk/r27c/toolchains/llvm/prebuilt/windows-x86_64/sysroot -vfsoverlay D:/r/_work/swift-build/swift-build/BinaryCache/ExperimentalOverlay/Android/clang/android-ndk-overlay.yaml -output-file-map Cxx\std\CMakeFiles\swiftCxxStdlib.dir\Release\output-file-map.json -I D:/r/_work/swift-build/swift-build/BinaryCache/ExperimentalOverlay/Cxx -I D:/r/_work/swift-build/swift-build/BinaryCache/ExperimentalOverlay/clang -I D:/r/_work/swift-build/swift-build/SourceCache/swift/Runtimes/Overlay/Cxx/cxxshim -I D:/r/_work/swift-build/swift-build/BinaryCache/ExperimentalRuntime/Core -I D:/r/_work/swift-build/swift-build/SourceCache/swift/Runtimes/Core/SwiftShims/swift/shims D:/r/_work/swift-build/swift-build/SourceCache/swift/Runtimes/Overlay/Cxx/std/std.swift D:/r/_work/swift-build/swift-build/SourceCache/swift/Runtimes/Overlay/Cxx/std/Chrono.swift D:/r/_work/swift-build/swift-build/SourceCache/swift/Runtimes/Overlay/Cxx/std/String.swift
warning: libc not found for 'aarch64-unknown-linux-android24'; C stdlib may be unavailable
<module-includes>:4:10: note: in file included from <module-includes>:4:

 2 | #include "CoreFoundationShims.h"

 3 | #include "ObjCShims.h"

 4 | #include "EmbeddedShims.h"

   |          `- note: in file included from <module-includes>:4:

 5 | #include "FoundationShims.h"

 6 | #include "GlobalObjects.h"



D:\r\_work\swift-build\swift-build\SourceCache\swift\Runtimes\Core\SwiftShims\swift\shims\EmbeddedShims.h:96:7: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)

 94 |   void* (* __ptrauth(0, 1, 0xe3ba) initializeWithCopyFn)(void*, void*, void*);

 95 | #else

 96 |   void* (*initializeWithCopyFn)(void*, void*, void*);

    |       |- warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)

    |       |- note: insert '_Nullable' if the pointer may be null

    |       `- note: insert '_Nonnull' if the pointer should never be null

 97 | #endif

 98 |   void  *assignWithCopyFn;



<module-includes>:4:10: note: in file included from <module-includes>:4:

 2 | #include "CoreFoundationShims.h"

 3 | #include "ObjCShims.h"

 4 | #include "EmbeddedShims.h"

   |          `- note: in file included from <module-includes>:4:

 5 | #include "FoundationShims.h"

 6 | #include "GlobalObjects.h"



D:\r\_work\swift-build\swift-build\SourceCache\swift\Runtimes\Core\SwiftShims\swift\shims\EmbeddedShims.h:96:10: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)

 94 |   void* (* __ptrauth(0, 1, 0xe3ba) initializeWithCopyFn)(void*, void*, void*);

 95 | #else

 96 |   void* (*initializeWithCopyFn)(void*, void*, void*);

    |          |- warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)

    |          |- note: insert '_Nullable' if the pointer may be null

    |          `- note: insert '_Nonnull' if the pointer should never be null

 97 | #endif

 98 |   void  *assignWithCopyFn;



<module-includes>:4:10: note: in file included from <module-includes>:4:

 2 | #include "CoreFoundationShims.h"

 3 | #include "ObjCShims.h"

 4 | #include "EmbeddedShims.h"

   |          `- note: in file included from <module-includes>:4:

 5 | #include "FoundationShims.h"

 6 | #include "GlobalObjects.h"



D:\r\_work\swift-build\swift-build\SourceCache\swift\Runtimes\Core\SwiftShims\swift\shims\EmbeddedShims.h:102:7: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)

100 |   void* (* __ptrauth(0, 1, 0x48d8) initializeWithTakeFn)(void*, void*, void*);

101 | #else

102 |   void* (*initializeWithTakeFn)(void *, void*, void*);

    |       |- warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)

    |       |- note: insert '_Nullable' if the pointer may be null

    |       `- note: insert '_Nonnull' if the pointer should never be null

103 | #endif

104 |   void  *assignWithTakeFn;



<module-includes>:4:10: note: in file included from <module-includes>:4:

 2 | #include "CoreFoundationShims.h"

 3 | #include "ObjCShims.h"

 4 | #include "EmbeddedShims.h"

   |          `- note: in file included from <module-includes>:4:

 5 | #include "FoundationShims.h"

 6 | #include "GlobalObjects.h"



D:\r\_work\swift-build\swift-build\SourceCache\swift\Runtimes\Core\SwiftShims\swift\shims\EmbeddedShims.h:102:10: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)

100 |   void* (* __ptrauth(0, 1, 0x48d8) initializeWithTakeFn)(void*, void*, void*);

101 | #else

102 |   void* (*initializeWithTakeFn)(void *, void*, void*);

    |          |- warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)

    |          |- note: insert '_Nullable' if the pointer may be null

    |          `- note: insert '_Nonnull' if the pointer should never be null

103 | #endif

104 |   void  *assignWithTakeFn;



<module-includes>:4:10: note: in file included from <module-includes>:4:

 2 | #include "CoreFoundationShims.h"

 3 | #include "ObjCShims.h"

 4 | #include "EmbeddedShims.h"

   |          `- note: in file included from <module-includes>:4:

 5 | #include "FoundationShims.h"

 6 | #include "GlobalObjects.h"



5 warnings generated.

D:\r\_work\swift-build\swift-build\SourceCache\swift\Runtimes\Core\SwiftShims\swift\shims\EmbeddedShims.h:173:8: warning: inferring '_Nonnull' for pointer type within array is deprecated

171 | 

172 | typedef struct {

173 |   void *inlineBuffer[3];

    |        `- warning: inferring '_Nonnull' for pointer type within array is deprecated

174 |   void *metadata;

175 | } ExistentialValue;

error: generate-pcm command failed due to exception 3 (use -v to see invocation)
<module-includes>:1:10: note: in file included from <module-includes>:1:

1 | #include "cstdlib"

  |          `- note: in file included from <module-includes>:1:

2 | 



C:\Users\runner\.setup-ndk\r27c\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\include\c++\v1\cstdlib:87:10: note: in file included from C:\Users\runner\.setup-ndk\r27c\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\include\c++\v1\cstdlib:87:

 85 | #include <__config>

 86 | 

 87 | #include <stdlib.h>

    |          `- note: in file included from C:\Users\runner\.setup-ndk\r27c\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\include\c++\v1\cstdlib:87:

 88 | 

 89 | #ifndef _LIBCPP_STDLIB_H



Assertion failed: existingFile.Name == name, file D:\r\_work\swift-build\swift-build\SourceCache\swift\lib\Basic\SourceLoc.cpp, line 151

Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.

Stack dump:

0.	Program arguments: D:\\r\\_work\\swift-build\\swift-build\\BinaryCache\\Library\\Developer\\Toolchains\\0.0.0+Asserts\\usr\\bin\\swift-frontend.exe -frontend -emit-pcm -module-name std_cstdlib -o C:\\Users\\runner\\AppData\\Local\\clang\\ModuleCache\\std_cstdlib-5MTS57LOM9CZ9C7TD577W7WTC.pcm -direct-clang-cc1-module-build C:\\Users\\runner\\.setup-ndk\\r27c\\toolchains\\llvm\\prebuilt\\windows-x86_64\\sysroot\\usr\\include\\c++\\v1\\module.modulemap -vfsoverlay D:\\r\\_work\\swift-build\\swift-build\\BinaryCache\\ExperimentalOverlay\\Android\\clang\\android-ndk-overlay.yaml -Xcc -cc1 -Xcc -fansi-escape-codes -Xcc -ferror-limit -Xcc 19 -Xcc -fsystem-module -Xcc -fmodule-map-file=C:\\Users\\runner\\.setup-ndk\\r27c\\toolchains\\llvm\\prebuilt\\windows-x86_64\\sysroot\\usr\\include\\c++\\v1\\module.modulemap -Xcc -fmodule-map-file=C:\\Users\\runner\\.setup-ndk\\r27c\\toolchains\\llvm\\prebuilt\\windows-x86_64\\sysroot\\usr\\include\\module.modulemap -Xcc -disable-free -Xcc -finclude-tree-preserve-pch-path -Xcc -emit-module -Xcc -x -Xcc c++ -Xcc C:\\Users\\runner\\.setup-ndk\\r27c\\toolchains\\llvm\\prebuilt\\windows-x86_64\\sysroot\\usr\\include\\c++\\v1\\module.modulemap -Xcc -target-abi -Xcc aapcs -Xcc -target-cpu -Xcc generic -Xcc -target-feature -Xcc +v8a -Xcc -target-feature -Xcc +fp-armv8 -Xcc -target-feature -Xcc +neon -Xcc -target-feature -Xcc +fix-cortex-a53-835769 -Xcc -target-feature -Xcc +outline-atomics -Xcc -triple -Xcc aarch64-unknown-linux-android24 -Xcc -fmodules-validate-system-headers -Xcc -fno-modules-prune-non-affecting-module-map-files -Xcc -isysroot -Xcc C:/Users/runner/.setup-ndk/r27c/toolchains/llvm/prebuilt/windows-x86_64/sysroot -Xcc -resource-dir -Xcc D:\\r\\_work\\swift-build\\swift-build\\BinaryCache\\Library\\Developer\\Toolchains\\0.0.0+Asserts\\usr\\lib\\swift\\clang -Xcc -fmodule-format=obj -Xcc -nostdsysteminc -Xcc -fmodule-file=_stdlib=C:\\Users\\runner\\AppData\\Local\\clang\\ModuleCache\\_stdlib-54ML5VSC1C0CRB2JP7YUKDV2U.pcm -Xcc -fmodule-file=std_private_assert=C:\\Users\\runner\\AppData\\Local\\clang\\ModuleCache\\std_private_assert-9RZ44I7FTN780P8LL9IKGJUWF.pcm -Xcc -isystem -Xcc C:/Users/runner/.setup-ndk/r27c/toolchains/llvm/prebuilt/windows-x86_64/sysroot\\usr\\include\\c++\\v1 -Xcc -isystem -Xcc D:\\r\\_work\\swift-build\\swift-build\\BinaryCache\\Library\\Developer\\Toolchains\\0.0.0+Asserts\\usr\\lib\\swift\\clang\\include -Xcc -internal-externc-isystem -Xcc C:/Users/runner/.setup-ndk/r27c/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/aarch64-linux-android -Xcc -internal-externc-isystem -Xcc C:/Users/runner/.setup-ndk/r27c/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include -Xcc -ivfsoverlay -Xcc D:\\r\\_work\\swift-build\\swift-build\\BinaryCache\\ExperimentalOverlay\\Android\\clang\\android-ndk-overlay.yaml -Xcc -fapinotes-swift-version=5 -Xcc -iapinotes-modules -Xcc D:\\r\\_work\\swift-build\\swift-build\\BinaryCache\\Library\\Developer\\Toolchains\\0.0.0+Asserts\\usr\\lib\\swift\\apinotes -Xcc -std=gnu++17 -Xcc -fapinotes-modules -Xcc -fcxx-exceptions -Xcc -fexceptions -Xcc -fskip-odr-check-in-gmf -Xcc -fmodules -Xcc -fmodule-name=std_cstdlib -Xcc -fmodules-search-all -Xcc -fno-implicit-modules -Xcc -fretain-comments-from-system-headers -Xcc -fno-signed-char -Xcc -fmodule-feature -Xcc swift -Xcc -pic-level -Xcc 2 -Xcc -disable-objc-default-synthesize-properties -Xcc -fbracket-depth -Xcc 256 -Xcc -fdeprecated-macro -Xcc -fexperimental-max-bitint-width=128 -Xcc -fgnuc-version=4.2.1 -Xcc -fblocks -Xcc -fno-convergent-functions -Xcc -ffp-contract=off -Xcc -fno-experimental-relative-c++-abi-vtables -Xcc -fno-file-reproducible -Xcc -O2 -Xcc -fcommon -Xcc -fdwarf2-cfi-asm -Xcc -fno-sanitize-address-use-odr-indicator -Xcc -fno-sanitize-memory-param-retval -Xcc -fmerge-all-constants -Xcc -fno-verbose-asm -Xcc -fregister-global-dtors-with-atexit -Xcc -fno-use-init-array -Xcc -funique-basic-block-section-names -Xcc -gno-structor-decl-linkage-names -Xcc -dwarf-version=4 -Xcc -debugger-tuning=gdb -Xcc -llvm-verify-each -Xcc -dwarf-ext-refs -Xcc -no-struct-path-tbaa -Xcc -fexperimental-assignment-tracking=disabled -Xcc -no-enable-noundef-analysis -Xcc -stack-protector-buffer-size -Xcc 0 -Xcc -finline-functions -Xcc -debug-info-kind=constructor -Xcc -Os -Xcc -fno-unroll-loops -Xcc -fno-loop-interchange -Xcc -save-temps=obj -Xcc -fdiagnostics-hotness-threshold=0 -Xcc -fdiagnostics-misexpect-tolerance=0 -Xcc -fno-split-cold-code -Xcc -D -Xcc SWIFT_STATIC_STDLIB -Xcc -D -Xcc _GNU_SOURCE -Xcc -D -Xcc __ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__ -Xcc -D -Xcc __SWIFT_ATTR_SUPPORTS_SENDING=1 -Xcc -D -Xcc __swift__=51000

1.	Swift version 6.3-dev (LLVM 82a300abdb6434e, Swift 3c9e5c02b903c76)

2.	Compiling with effective version 5.10

3.	C:/Users/runner/.setup-ndk/r27c/toolchains/llvm/prebuilt/windows-x86_64/sysroot\usr\include\c++\v1\stdlib.h:113:81: current parser token '{'

Exception Code: 0x80000003

 #0 0x00007ff62158c8e5 (D:\r\_work\swift-build\swift-build\BinaryCache\Library\Developer\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x712c8e5)

 #1 0x00007ffed1821989 (C:\Windows\System32\ucrtbase.dll+0xc1989)

 #2 0x00007ffed1804ab1 (C:\Windows\System32\ucrtbase.dll+0xa4ab1)

 #3 0x00007ffed1822986 (C:\Windows\System32\ucrtbase.dll+0xc2986)

 #4 0x00007ffed1822b61 (C:\Windows\System32\ucrtbase.dll+0xc2b61)

 #5 0x00007ff61c899443 (D:\r\_work\swift-build\swift-build\BinaryCache\Library\Developer\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x2439443)

 #6 0x00007ff61c314b5e (D:\r\_work\swift-build\swift-build\BinaryCache\Library\Developer\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x1eb4b5e)

 #7 0x00007ff61c32c012 (D:\r\_work\swift-build\swift-build\BinaryCache\Library\Developer\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x1ecc012)

 #8 0x00007ff61c32bf44 (D:\r\_work\swift-build\swift-build\BinaryCache\Library\Developer\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x1ecbf44)

 #9 0x00007ff61c32c824 (D:\r\_work\swift-build\swift-build\BinaryCache\Library\Developer\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x1ecc824)

#10 0x00007ff61ed3c4ac (D:\r\_work\swift-build\swift-build\BinaryCache\Library\Developer\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x48dc4ac)

#11 0x00007ff61c32c675 (D:\r\_work\swift-build\swift-build\BinaryCache\Library\Developer\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x1ecc675)

#12 0x00007ff620614470 (D:\r\_work\swift-build\swift-build\BinaryCache\Library\Developer\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x61b4470)

#13 0x00007ff61f2bc646 (D:\r\_work\swift-build\swift-build\BinaryCache\Library\Developer\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x4e5c646)

#14 0x00007ff61fc1e4c5 (D:\r\_work\swift-build\swift-build\BinaryCache\Library\Developer\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x57be4c5)

#15 0x00007ff61f2b7540 (D:\r\_work\swift-build\swift-build\BinaryCache\Library\Developer\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x4e57540)

#16 0x00007ff61f6f42ca (D:\r\_work\swift-build\swift-build\BinaryCache\Library\Developer\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x52942ca)

#17 0x00007ff61f6e158f (D:\r\_work\swift-build\swift-build\BinaryCache\Library\Developer\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x528158f)

#18 0x00007ff61f6e1144 (D:\r\_work\swift-build\swift-build\BinaryCache\Library\Developer\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x5281144)

#19 0x00007ff61ef34910 (D:\r\_work\swift-build\swift-build\BinaryCache\Library\Developer\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x4ad4910)

#20 0x00007ff61ef4f081 (D:\r\_work\swift-build\swift-build\BinaryCache\Library\Developer\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x4aef081)

#21 0x00007ff61ef32a69 (D:\r\_work\swift-build\swift-build\BinaryCache\Library\Developer\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x4ad2a69)

#22 0x00007ff61ef32d78 (D:\r\_work\swift-build\swift-build\BinaryCache\Library\Developer\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x4ad2d78)

#23 0x00007ff61ef339ee (D:\r\_work\swift-build\swift-build\BinaryCache\Library\Developer\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x4ad39ee)

#24 0x00007ff61ef7f357 (D:\r\_work\swift-build\swift-build\BinaryCache\Library\Developer\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x4b1f357)

#25 0x00007ff61ef32a20 (D:\r\_work\swift-build\swift-build\BinaryCache\Library\Developer\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x4ad2a20)

#26 0x00007ff61ef32d78 (D:\r\_work\swift-build\swift-build\BinaryCache\Library\Developer\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x4ad2d78)

#27 0x00007ff61ef339ee (D:\r\_work\swift-build\swift-build\BinaryCache\Library\Developer\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x4ad39ee)

#28 0x00007ff61ef37f1a (D:\r\_work\swift-build\swift-build\BinaryCache\Library\Developer\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x4ad7f1a)

#29 0x00007ff61ef3cd39 (D:\r\_work\swift-build\swift-build\BinaryCache\Library\Developer\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x4adcd39)

#30 0x00007ff61ed22811 (D:\r\_work\swift-build\swift-build\BinaryCache\Library\Developer\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x48c2811)

#31 0x00007ff61ed225fc (D:\r\_work\swift-build\swift-build\BinaryCache\Library\Developer\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x48c25fc)

#32 0x00007ff61ed04273 (D:\r\_work\swift-build\swift-build\BinaryCache\Library\Developer\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x48a4273)

#33 0x00007ff61c270cb7 (D:\r\_work\swift-build\swift-build\BinaryCache\Library\Developer\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x1e10cb7)

#34 0x00007ff61aa53fdb (D:\r\_work\swift-build\swift-build\BinaryCache\Library\Developer\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x5f3fdb)

#35 0x00007ff61aa549a9 (D:\r\_work\swift-build\swift-build\BinaryCache\Library\Developer\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x5f49a9)

#36 0x00007ff61aa571e7 (D:\r\_work\swift-build\swift-build\BinaryCache\Library\Developer\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x5f71e7)

#37 0x00007ff61a8aec3d (D:\r\_work\swift-build\swift-build\BinaryCache\Library\Developer\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x44ec3d)

#38 0x00007ff61a8ae743 (D:\r\_work\swift-build\swift-build\BinaryCache\Library\Developer\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x44e743)

#39 0x00007ff6215f5e70 (D:\r\_work\swift-build\swift-build\BinaryCache\Library\Developer\Toolchains\0.0.0+Asserts\usr\bin\swift-frontend.exe+0x7195e70)

#40 0x00007ffed27ae8d7 (C:\Windows\System32\KERNEL32.DLL+0x2e8d7)

#41 0x00007ffed431c34c (C:\Windows\SYSTEM32\ntdll.dll+0x3c34c)


ninja: build stopped: subcommand failed.

@finagolfin
Copy link
Copy Markdown
Member Author

Huh, that is a strange error, as it seems to happen when opening the stdlib.h header from the Android NDK sysroot, which should have no connection to the target Android API level. Does the standard stdlib build, ie what is called Build-SDK at the end of this Windows toolchain log, work fine? The new "experimental" Runtimes/ build config you are using here is not tested much, only on your Windows CI and by a single macOS build preset.

It is extremely strange that this would work for API 28 and not for API 24 in this way, would it be feasible to bisect the API levels between those two and see at what API level it starts failing? The other possibility is that this is simply a flake...

@Steelskin
Copy link
Copy Markdown
Contributor

Huh, that is a strange error, as it seems to happen when opening the stdlib.h header from the Android NDK sysroot, which should have no connection to the target Android API level. Does the standard stdlib build, ie what is called Build-SDK at the end of this Windows toolchain log, work fine? The new "experimental" Runtimes/ build config you are using here is not tested much, only on your Windows CI and by a single macOS build preset.

I believe this is highlighting a pre-existing issue that is triggered by these changes, not caused by these changes. The regular SDK and the experimental dynamic SDK both build fine.

It is extremely strange that this would work for API 28 and not for API 24 in this way, would it be feasible to bisect the API levels between those two and see at what API level it starts failing?

I am starting jobs for this starting with 26, and I'll keep you posted.

The other possibility is that this is simply a flake...

We do builds in parallel for every architecture and all 4 Android architectures failed in the same manner.

@finagolfin
Copy link
Copy Markdown
Member Author

I believe this is highlighting a pre-existing issue that is triggered by these changes, not caused by these changes. The regular SDK and the experimental dynamic SDK both build fine.

Oh, great. 👍

I am starting jobs for this starting with 26, and I'll keep you posted.

Thank you, ❤️ I'm starting some linux CI jobs using this new base API level config today, and will let you know what that finds too.

We do builds in parallel for every architecture and all 4 Android architectures failed in the same manner.

Good point, you did mention that. 😶‍🌫️

Looking at the cross-compilation flags used, one key difference that stands out to me is that you guys are building with -target aarch64-unknown-linux-android24, but the standard build-script config in stdlib/ does not pass in an API level for the stdlib build, eg this failing command with NDK 29, only using the API level for the corelibs, hence this other issue I filed, #85522.

I wonder how well applying that API level in the Runtimes/ build is working for you guys, always been working fine? Is it possible you had to pass in the API level somewhere else in the config too, and that is still stuck on 28? Just spitballing here...

@Steelskin
Copy link
Copy Markdown
Contributor

This passed with API version 26. I am trying API version 25 now.

@Steelskin
Copy link
Copy Markdown
Contributor

I am seeing the same issue with 25. So this is working with API 26+. In the short term, do you have any objection to setting the default to 26 rather than 24? We can work on the 25- issue separately.

@finagolfin
Copy link
Copy Markdown
Member Author

Is it failing for API 25 with the exact same error output? Would help to paste that too...

Any API level you guys want to build the Android SDK with on Windows is fine with me, as I haven't used Swift on Windows. We don't build the new Runtimes/ config on the official Android CI that produces the SDK bundles for linux and mac, so we haven't seen this failure.

We would like to get those linux/mac SDK bundles down to API level 24 this month, but whatever API level you guys are comfortable with on Windows should be fine. I will update this pull to 26 and we can go from there.

@finagolfin
Copy link
Copy Markdown
Member Author

@swift-ci smoke test

@finagolfin finagolfin changed the title build.ps1: Build the Android SDKs for API 24 instead build.ps1: Build the Android SDKs for API 26 instead Feb 8, 2026
@madsodgaard
Copy link
Copy Markdown
Contributor

So from the build logs my hypothesis is that this has something to do with file-paths case sensitivity on Windows in the new runtime overlays. Specifically since we are hitting

assert(existingFile.Name == name);
- which means the file is already open, but under a different filename. I am not sure why this would be an error on API 25 but not 26.

@Steelskin could you maybe try do another run on API 24 or 25 but changing swift/Runtimes/Overlay/Android/clang/CMakeLists.txt to do the following instead, which should make sure the file paths casing are the same.

set(NDK_SYSROOT_INCLUDE "${CMAKE_ANDROID_NDK}/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include")

# RESOLVE THE REAL PATH (Fixes casing mismatches like 'C:' vs 'c:')
get_filename_component(CANONICAL_NDK_INCLUDE "${NDK_SYSROOT_INCLUDE}" REALPATH)

# FIXME: how do we determine the sysroot? `CMAKE_SYSROOT` does not contain the sysroot.
file(CONFIGURE
  OUTPUT android-ndk-overlay.yaml
  CONTENT [[
---
version: 0
case-sensitive: false
use-external-names: true
roots:
  - name: "@CANONICAL_NDK_INCLUDE@"
    type: directory
    contents:
      - name: module.modulemap
        type: file
        external-contents: "@CMAKE_CURRENT_SOURCE_DIR@/android.modulemap"
      - name: SwiftAndroidNDK.h
        type: file
        external-contents: "@CMAKE_CURRENT_SOURCE_DIR@/SwiftAndroidNDK.h"
      - name: SwiftBionic.h
        type: file
        external-contents: "@CMAKE_CURRENT_SOURCE_DIR@/SwiftBionic.h"
]]
ESCAPE_QUOTES @ONLY NEWLINE_STYLE LF)

@finagolfin
Copy link
Copy Markdown
Member Author

@swift-ci build toolchain windows

2 similar comments
@finagolfin
Copy link
Copy Markdown
Member Author

@swift-ci build toolchain windows

@finagolfin
Copy link
Copy Markdown
Member Author

@swift-ci build toolchain windows

@finagolfin
Copy link
Copy Markdown
Member Author

@swift-ci build toolchain windows

@finagolfin
Copy link
Copy Markdown
Member Author

I tried building the Windows toolchain against Android API 24 with only two experimental Android SDKs, AArch64 and armv7, and hit an issue where Testing apparently depends on the usual stdlib/cmake/-configured SDK to be built: it doesn't build against the experimental Runtimes/ SDK yet. I'll add those back and see if the toolchain fully builds.

Also, I'm unable to reproduce the build errors shown on the BCNY CI, for which I can think of three possible reasons:

  1. This CI now uses NDK 28c, whereas we were all using NDK 27c on Windows before.
  2. Obviously several trunk commits were added by others since then, maybe that fixed some bug.
  3. The BCNY CI differs in some important way in its config from the official CI.

To see if these other possibilities still cause problems, would you try the build.ps1 change alone from this pull again on your BCNY CI, @Steelskin? If the problem is gone there, we can get this in.

@finagolfin
Copy link
Copy Markdown
Member Author

@swift-ci build toolchain windows

@finagolfin
Copy link
Copy Markdown
Member Author

I activated all four Android SDKs in the last run and everything built fine at Android API 24, only failing a single unrelated lldb test. Let's see if that test's a flake, re-running.

@swift-ci build toolchain windows

@finagolfin finagolfin changed the title build.ps1: Build the Android SDKs for API 26 instead build.ps1: Build the Android SDKs for API 24 instead Mar 15, 2026
@finagolfin
Copy link
Copy Markdown
Member Author

Sigh, another lldb test flaked

@swift-ci build toolchain windows

@finagolfin
Copy link
Copy Markdown
Member Author

Alright, building against Android API 24 on the PR toolchain CI worked, just waiting to hear from the BCNY people now if you're good with this change.

Also, we've never supported older than API level 21, so changed that minumum.
@finagolfin
Copy link
Copy Markdown
Member Author

Now that a Windows toolchain built fully with two Android SDKs on CI, earlier with all four arches, proposing that we get this in.

@swift-ci smoke test

@finagolfin
Copy link
Copy Markdown
Member Author

Ping @compnerd or @Steelskin, any further comment on this trunk change for Android on Windows? If it still causes a problem for your BCNY CI alone, presumably you can roll it back locally there, but it causes no problem on the official Windows toolchain CI.

@compnerd
Copy link
Copy Markdown
Member

Ping @compnerd or @Steelskin, any further comment on this trunk change for Android on Windows? If it still causes a problem for your BCNY CI alone, presumably you can roll it back locally there, but it causes no problem on the official Windows toolchain CI.

The only comment I have is please keep this in sync with the other builds of the Android SDK.

@finagolfin
Copy link
Copy Markdown
Member Author

Sure, I have submitted this for the official trunk Android CI that runs on linux also, swiftlang/swift-docker#528, so it is ready to go there too.

@finagolfin finagolfin merged commit 74fc429 into swiftlang:main Mar 17, 2026
3 checks passed
@finagolfin finagolfin deleted the droid24 branch March 17, 2026 12:11
@finagolfin
Copy link
Copy Markdown
Member Author

This just passed the Windows trunk snapshot toolchain CI, the only Windows CI that currently builds and tests the Android SDKs. @Steelskin, please let us know if you still see any problems with this pull in your local CI.

@Steelskin
Copy link
Copy Markdown
Contributor

This just passed the Windows trunk snapshot toolchain CI, the only Windows CI that currently builds and tests the Android SDKs. @Steelskin, please let us know if you still see any problems with this pull in your local CI.

We have the same issue as before on our CI. I will take a look as to why this is happening because this is a compiler crash. Even if our configuration is wrong, the compiler should not crash as a result.

We don't use build.ps1 to build, as we have our own custom GHA actions to do so. For now, we're going to keep our build with SDK 28. Once the issue is found and fixed, we'll downgrade to 24 too.

@finagolfin
Copy link
Copy Markdown
Member Author

OK, let us know what you find. 👍

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants