Skip to content

swift-inspect: repair build for Android#89536

Closed
compnerd wants to merge 1 commit into
swiftlang:mainfrom
compnerd:android
Closed

swift-inspect: repair build for Android#89536
compnerd wants to merge 1 commit into
swiftlang:mainfrom
compnerd:android

Conversation

@compnerd

Copy link
Copy Markdown
Member

Android now imports FILE as a typed pointer rather than an OpaquePointer. Remove the conditional typealias.

Android now imports `FILE` as a typed pointer rather than an
`OpaquePointer`. Remove the conditional typealias.
@compnerd compnerd requested review from al45tair and mikeash as code owners May 29, 2026 04:16
@compnerd

Copy link
Copy Markdown
Member Author

CC: @madsodgaard

@compnerd

Copy link
Copy Markdown
Member Author

@swift-ci please smoke test

@madsodgaard

Copy link
Copy Markdown
Contributor

Hm this does not actually seem right.

The changes we did with API notes should mean that FILE should always import as OpaquePointer on Android, never as a typed pointer.

@compnerd

Copy link
Copy Markdown
Member Author

Then the APINotes are not always being loaded.

@finagolfin

finagolfin commented May 29, 2026

Copy link
Copy Markdown
Member

Where do you see this failure exactly? The Windows trunk snapshot toolchain CI cross-compiles swift-inspect for Android without a problem, which it wasn't before Mads's API note pulls #88714 and #88751 were merged.

Is it possible that whatever CI you are testing on is not pulling in the Android API notes properly?

@finagolfin finagolfin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break other Android API levels and is likely incorrect.

@finagolfin

finagolfin commented May 29, 2026

Copy link
Copy Markdown
Member

OK, I may have tracked this down: it looks like the Windows installer lists each Android API note separately, unlike linux/Mac our SDK bundle packaging script where all are copied over. You will likely need to add Mads's new API note there, alongside a previous posix_spawn API note that you added in #79687 but isn't installed there either. The trunk Android SDK bundles used on linux/mac currently show four API note files.

@compnerd

Copy link
Copy Markdown
Member Author

OK, I may have tracked this down: it looks like the Windows installer lists each Android API note separately, unlike linux/Mac our SDK bundle packaging script where all are copied over. You will likely need to add Mads's new API note there, alongside a previous posix_spawn API note that you added in #79687 but isn't installed there either. The trunk Android SDK bundles used on linux/mac currently show four API note files.

That is certainly an issue that should've been tested before @madsodgaard's patch was merged (I didn't get around to reviewing the change before it was merged). However, that is a distribution issue, the build that occurs here is prior to the packaged version and is done from the staged build.

@finagolfin

finagolfin commented May 29, 2026

Copy link
Copy Markdown
Member

How does your build differ from the current trunk Windows snapshot toolchain CI, which always cross-compiles swift-inspect to Android API 23 successfully using build.ps1?

[2026-05-29T02:16:46.440Z] [2026-05-29 02:16:44] Building 'C:\Users\swift-ci\jenkins\workspace\swift-main-windows-toolchain\swift\tools\swift-inspect' to 'T:\aarch64-unknown-linux-android23\SwiftInspect' ...
[2026-05-29T02:16:46.440Z] C:\Program Files\CMake\bin\cmake.exe -B T:\aarch64-unknown-linux-android23\SwiftInspect -S C:\Users\swift-ci\jenkins\workspace\swift-main-windows-toolchain\swift\tools\swift-inspect -G Ninja -D ArgumentParser_DIR= -D CMAKE_ANDROID_API=23 -D CMAKE_ANDROID_ARCH_ABI=arm64-v8a -D CMAKE_ANDROID_NDK=T:/android-ndk-r28c -D CMAKE_BUILD_TYPE=Release -D CMAKE_C_COMPILER_TARGET=aarch64-unknown-linux-android23 -D CMAKE_C_FLAGS=-ffunction-sections -fdata-sections -D CMAKE_CXX_COMPILER_TARGET=aarch64-unknown-linux-android23 -D CMAKE_CXX_FLAGS=-ffunction-sections -fdata-sections -D CMAKE_EXE_LINKER_FLAGS=-Xlinker --build-id=sha1 -Xlinker --no-rosegment -Xlinker --no-undefined-version -Xlinker --fatal-warnings -Xlinker --gc-sections -Xlinker --no-undefined -Xlinker --gc-sections -D CMAKE_EXECUTABLE_FORMAT=ELF -D CMAKE_FIND_PACKAGE_PREFER_CONFIG=YES -D CMAKE_INSTALL_PREFIX=T:/Program Files/Swift/Platforms/Android.platform/Developer/Library/aarch64-unknown-linux-android -D CMAKE_MAKE_PROGRAM=C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe -D CMAKE_MODULE_LINKER_FLAGS=-Xlinker --build-id=sha1 -Xlinker --no-rosegment -Xlinker --no-undefined-version -Xlinker --fatal-warnings -Xlinker --gc-sections -Xlinker --no-undefined -D CMAKE_PROJECT_INCLUDE=C:/Users/swift-ci/jenkins/workspace/swift-main-windows-toolchain/swift/utils/android-overrides.cmake -D CMAKE_SHARED_LINKER_FLAGS=-Xlinker --build-id=sha1 -Xlinker --no-rosegment -Xlinker --no-undefined-version -Xlinker --fatal-warnings -Xlinker --gc-sections -Xlinker --no-undefined -D CMAKE_Swift_COMPILER=T:/5/bin/swiftc.exe -D CMAKE_Swift_COMPILER_ID=Apple -D CMAKE_Swift_COMPILER_TARGET=aarch64-unknown-linux-android23 -D CMAKE_Swift_COMPILER_WORKS=YES -D CMAKE_Swift_FLAGS=-Xcc \"-IT:/Program Files/Swift/Platforms/Android.platform/Developer/SDKs/Android.sdk/usr/include\" -Xcc \"-IT:/Program Files/Swift/Platforms/Android.platform/Developer/SDKs/Android.sdk/usr/lib/swift\" -Xcc \"-IT:/Program Files/Swift/Platforms/Android.platform/Developer/SDKs/Android.sdk/usr/include/swift/SwiftRemoteMirror\" \"-LT:/Program Files/Swift/Platforms/Android.platform/Developer/SDKs/Android.sdk/usr/lib/swift/Android/aarch64\" -sdk \"T:/Program Files/Swift/Platforms/Android.platform/Developer/SDKs/Android.sdk\" -sysroot T:/android-ndk-r28c/toolchains/llvm/prebuilt/windows-x86_64/sysroot -Xclang-linker -target -Xclang-linker aarch64-unknown-linux-android23 -Xclang-linker --sysroot -Xclang-linker T:/android-ndk-r28c/toolchains/llvm/prebuilt/windows-x86_64/sysroot -Xclang-linker -resource-dir -Xclang-linker T:/android-ndk-r28c/toolchains/llvm/prebuilt/windows-x86_64/lib/clang/19 -gnone -D CMAKE_Swift_FLAGS_RELEASE=-O -D CMAKE_Swift_FLAGS_RELWITHDEBINFO=-O -D CMAKE_SYSROOT=T:/android-ndk-r28c/toolchains/llvm/prebuilt/windows-x86_64/sysroot -D CMAKE_SYSTEM_NAME=Android -D CMAKE_SYSTEM_PROCESSOR=aarch64 -D SWIFT_ANDROID_LD_PATH=T:/5/bin/ld.lld -D SWIFT_ANDROID_NDK_PATH=T:/android-ndk-r28c
[2026-05-29T02:16:46.440Z] -- Android: Targeting API '23' with architecture 'arm64', ABI 'arm64-v8a', and processor 'aarch64'
[2026-05-29T02:16:46.440Z] -- Android: Selected unified Clang toolchain
[2026-05-29T02:16:46.440Z] -- The C compiler identification is Clang 19.0.1
[2026-05-29T02:16:46.440Z] -- The CXX compiler identification is Clang 19.0.1
[2026-05-29T02:16:46.694Z] -- The Swift compiler identification is Apple 6.5
[2026-05-29T02:16:46.694Z] -- Detecting C compiler ABI info
[2026-05-29T02:16:47.252Z] -- Detecting C compiler ABI info - done
[2026-05-29T02:16:47.252Z] -- Check for working C compiler: T:/android-ndk-r28c/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe - skipped
[2026-05-29T02:16:47.252Z] -- Detecting C compile features
[2026-05-29T02:16:47.252Z] -- Detecting C compile features - done
[2026-05-29T02:16:47.252Z] -- Detecting CXX compiler ABI info
[2026-05-29T02:16:47.506Z] -- Detecting CXX compiler ABI info - done
[2026-05-29T02:16:47.506Z] -- Check for working CXX compiler: T:/android-ndk-r28c/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe - skipped
[2026-05-29T02:16:47.506Z] -- Detecting CXX compile features
[2026-05-29T02:16:47.506Z] -- Detecting CXX compile features - done
[2026-05-29T02:16:52.733Z] -- Could NOT find dispatch (missing: dispatch_DIR)
[2026-05-29T02:16:52.733Z] -- Could NOT find Foundation (missing: Foundation_DIR)
[2026-05-29T02:16:52.733Z] -- Could NOT find XCTest (missing: XCTest_DIR)
[2026-05-29T02:16:52.733Z] -- Configuring done (6.4s)
[2026-05-29T02:16:52.733Z] -- Generating done (0.1s)
[2026-05-29T02:16:52.733Z] CMake Warning:
[2026-05-29T02:16:52.733Z]   Manually-specified variables were not used by the project:
[2026-05-29T02:16:52.733Z] 
[2026-05-29T02:16:52.733Z]     SWIFT_ANDROID_NDK_PATH
[2026-05-29T02:16:52.733Z] 
[2026-05-29T02:16:52.733Z] 
[2026-05-29T02:16:52.733Z] -- Build files have been written to: T:/aarch64-unknown-linux-android23/SwiftInspect
[2026-05-29T02:16:52.733Z] [1/7][ 14%][0.136s]Building C object CMakeFiles/AndroidCLib.dir/Sources/AndroidCLib/heap.c.o
[2026-05-29T02:16:52.733Z] [2/7][ 28%][0.217s]Linking C static library lib\libAndroidCLib.a
[2026-05-29T02:16:55.237Z] [3/7][ 42%][2.616s]Linking Swift static library lib\libArgumentParserToolInfo.a
[2026-05-29T02:17:01.771Z] [4/7][ 57%][9.056s]Linking Swift static library lib\libSwiftInspectLinux.a
[2026-05-29T02:17:05.024Z] [5/7][ 71%][12.012s]Linking Swift static library lib\libArgumentParser.a
--- snip source warnings ---
[2026-05-29T02:17:11.540Z] [6/7][ 85%][18.231s]Linking Swift executable bin\swift-inspect
[2026-05-29T02:17:11.540Z] [6/7][ 85%][18.232s]Install the project...
[2026-05-29T02:17:11.540Z] -- Install configuration: "Release"
[2026-05-29T02:17:11.540Z] -- Installing: T:/Program Files/Swift/Platforms/Android.platform/Developer/Library/aarch64-unknown-linux-android/bin/swift-inspect
[2026-05-29T02:17:11.540Z] [2026-05-29 02:17:09] Finished building 'C:\Users\swift-ci\jenkins\workspace\swift-main-windows-toolchain\swift\tools\swift-inspect' to 'T:\aarch64-unknown-linux-android23\SwiftInspect' in 00:00:24.9338419
[2026-05-29T02:17:11.540Z] 
[2026-05-29T02:17:11.540Z] [2026-05-29 02:17:09] Building 'C:\Users\swift-ci\jenkins\workspace\swift-main-windows-toolchain\swift\tools\swift-inspect' to 'T:\x86_64-unknown-linux-android23\SwiftInspect' ...
[2026-05-29T02:17:11.540Z] C:\Program Files\CMake\bin\cmake.exe -B T:\x86_64-unknown-linux-android23\SwiftInspect -S C:\Users\swift-ci\jenkins\workspace\swift-main-windows-toolchain\swift\tools\swift-inspect -G Ninja -D ArgumentParser_DIR= -D CMAKE_ANDROID_API=23 -D CMAKE_ANDROID_ARCH_ABI=x86_64 -D CMAKE_ANDROID_NDK=T:/android-ndk-r28c -D CMAKE_BUILD_TYPE=Release -D CMAKE_C_COMPILER_TARGET=x86_64-unknown-linux-android23 -D CMAKE_C_FLAGS=-ffunction-sections -fdata-sections -D CMAKE_CXX_COMPILER_TARGET=x86_64-unknown-linux-android23 -D CMAKE_CXX_FLAGS=-ffunction-sections -fdata-sections -D CMAKE_EXE_LINKER_FLAGS=-Xlinker --build-id=sha1 -Xlinker --no-rosegment -Xlinker --no-undefined-version -Xlinker --fatal-warnings -Xlinker --gc-sections -Xlinker --no-undefined -Xlinker --gc-sections -D CMAKE_EXECUTABLE_FORMAT=ELF -D CMAKE_FIND_PACKAGE_PREFER_CONFIG=YES -D CMAKE_INSTALL_PREFIX=T:/Program Files/Swift/Platforms/Android.platform/Developer/Library/x86_64-unknown-linux-android -D CMAKE_MAKE_PROGRAM=C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe -D CMAKE_MODULE_LINKER_FLAGS=-Xlinker --build-id=sha1 -Xlinker --no-rosegment -Xlinker --no-undefined-version -Xlinker --fatal-warnings -Xlinker --gc-sections -Xlinker --no-undefined -D CMAKE_PROJECT_INCLUDE=C:/Users/swift-ci/jenkins/workspace/swift-main-windows-toolchain/swift/utils/android-overrides.cmake -D CMAKE_SHARED_LINKER_FLAGS=-Xlinker --build-id=sha1 -Xlinker --no-rosegment -Xlinker --no-undefined-version -Xlinker --fatal-warnings -Xlinker --gc-sections -Xlinker --no-undefined -D CMAKE_Swift_COMPILER=T:/5/bin/swiftc.exe -D CMAKE_Swift_COMPILER_ID=Apple -D CMAKE_Swift_COMPILER_TARGET=x86_64-unknown-linux-android23 -D CMAKE_Swift_COMPILER_WORKS=YES -D CMAKE_Swift_FLAGS=-Xcc \"-IT:/Program Files/Swift/Platforms/Android.platform/Developer/SDKs/Android.sdk/usr/include\" -Xcc \"-IT:/Program Files/Swift/Platforms/Android.platform/Developer/SDKs/Android.sdk/usr/lib/swift\" -Xcc \"-IT:/Program Files/Swift/Platforms/Android.platform/Developer/SDKs/Android.sdk/usr/include/swift/SwiftRemoteMirror\" \"-LT:/Program Files/Swift/Platforms/Android.platform/Developer/SDKs/Android.sdk/usr/lib/swift/Android/x86_64\" -sdk \"T:/Program Files/Swift/Platforms/Android.platform/Developer/SDKs/Android.sdk\" -sysroot T:/android-ndk-r28c/toolchains/llvm/prebuilt/windows-x86_64/sysroot -Xclang-linker -target -Xclang-linker x86_64-unknown-linux-android23 -Xclang-linker --sysroot -Xclang-linker T:/android-ndk-r28c/toolchains/llvm/prebuilt/windows-x86_64/sysroot -Xclang-linker -resource-dir -Xclang-linker T:/android-ndk-r28c/toolchains/llvm/prebuilt/windows-x86_64/lib/clang/19 -gnone -D CMAKE_Swift_FLAGS_RELEASE=-O -D CMAKE_Swift_FLAGS_RELWITHDEBINFO=-O -D CMAKE_SYSROOT=T:/android-ndk-r28c/toolchains/llvm/prebuilt/windows-x86_64/sysroot -D CMAKE_SYSTEM_NAME=Android -D CMAKE_SYSTEM_PROCESSOR=x86_64 -D SWIFT_ANDROID_LD_PATH=T:/5/bin/ld.lld -D SWIFT_ANDROID_NDK_PATH=T:/android-ndk-r28c

@compnerd

Copy link
Copy Markdown
Member Author

I'll get the exact invocation once the build is repaired - seems that something was committed that broken the early builds resulting in not being able to build at all currently.

@finagolfin

Copy link
Copy Markdown
Member

Probably fixed by #89599 instead

@compnerd

compnerd commented Jun 8, 2026

Copy link
Copy Markdown
Member Author

Yes, verified that it has been fixed. Thanks @finagolfin!

@compnerd compnerd closed this Jun 8, 2026
@compnerd compnerd deleted the android branch June 8, 2026 01:00
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.

3 participants