ITADN

Swift Android SDK injects broken linker flags that override manual fixes

#224OpenRoshankumar350 创建于 2025-10-25
R
Roshankumar350commented
**When building a Swift package for Android using the official Swift 6.3 snapshot (aarch64-unknown-linux-android28), the SDK injects hardcoded linker flags pointing to nonexistent runtime libraries. These flags override manually specified paths and cause all builds to fail, even when correct paths are provided via -Xlinker or unsafeFlags.** ### **Environment** **Toolchain:** swift-DEVELOPMENT-SNAPSHOT-2025-10-17-a-android-0.1.artifactbundle **Target:** aarch64-unknown-linux-android28 **Host**: macOS (Darwin) **NDK:** android-ndk-r27d **SwiftPM:** via swift build ### Repro Steps Create a minimal Swift executable package. Attempt to build with: `swift build \ --swift-sdk aarch64-unknown-linux-android28 \ -c release ` Observe linker errors: `ld.lld: error: cannot open .../libclang_rt.builtins.a: No such file or directory ld.lld: error: unable to find library -l:libunwind.a ` ### Observed Behavior SDK injects linker flags for: - libclang_rt.builtins.a at: `swift-resources/usr/lib/swift-aarch64/clang/lib/aarch64-unknown-linux-android28/libclang_rt.builtins.a ` → This path does not exist. - -l:libunwind.a → Even when manually injected via a stub .a file, the SDK still overrides it. - These flags are injected even when: - -Xlinker is used manually - .unsafeFlags are added to Package.swift
1 条评论