-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Description
Describe the bug
In the quasi-official swift-android-sdk 6.2 release, libFoundationXML.so seems to have an unstated dependency on the system libz.so. This causes it to fail at load time.
Interestingly, libFoundationNetworking.so does state this dependency, though I didn't test loading it.
To Reproduce
run System.loadLibrary("FoundationXML")
in an android app, and get
java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "deflateInit2_" referenced by "[...]/lib/arm64/libFoundationXML.so"...
Alternatively, just looking at the artifact statically:
root@54093e12c46b:~/.swiftpm/swift-sdks/swift-6.2-RELEASE-android-0.1.artifactbundle/swift-android# nm swift-resources/usr/lib/swift-aarch64/android/libFoundationXML.so | grep deflateInit
U deflateInit2_
root@54093e12c46b:~/.swiftpm/swift-sdks/swift-6.2-RELEASE-android-0.1.artifactbundle/swift-android# patchelf --print-needed swift-resources/usr/lib/swift-aarch64/android/libFoundationXML.so
libFoundation.so
libFoundationInternationalization.so
libFoundationEssentials.so
lib_FoundationICU.so
libswiftDispatch.so
libdispatch.so
libBlocksRuntime.so
libswiftCore.so
libswift_Concurrency.so
libswift_StringProcessing.so
libswift_RegexParser.so
libswift_Builtin_float.so
libswift_math.so
libswiftAndroid.so
libm.so
libdl.so
libc.so
root@54093e12c46b:~/.swiftpm/swift-sdks/swift-6.2-RELEASE-android-0.1.artifactbundle/swift-android# nm ndk-sysroot/usr/lib/aarch64-linux-android/28/libz.so | grep deflateInit
00000000000021d8 T deflateInit2_
00000000000021e0 T deflateInit_
root@54093e12c46b:~/.swiftpm/swift-sdks/swift-6.2-RELEASE-android-0.1.artifactbundle/swift-android# patchelf --print-needed swift-resources/usr/lib/swift-aarch64/android/libFoundationNetworking.so
libFoundation.so
libz.so
libFoundationInternationalization.so
libFoundationEssentials.so
lib_FoundationICU.so
libswiftDispatch.so
libdispatch.so
libBlocksRuntime.so
libswiftCore.so
libswift_Concurrency.so
libswift_StringProcessing.so
libswift_RegexParser.so
libswift_Builtin_float.so
libswift_math.so
libswiftSynchronization.so
libswiftAndroid.so
libm.so
libdl.so
libc.so
Patching with patchelf --add-needed libz.so libFoundationXML.so
seems to work around the issue
Expected behavior
library should load as provided
Configuration (please complete the following information):
- Swift Version: 6.2-RELEASE
- OS: Android
- OS Version: API 36
Regression information:
Additional context