-
Notifications
You must be signed in to change notification settings - Fork 289
Closed
Labels
Description
Using NDK r22-beta1 (22.0.6917172-beta1) on macOS with ndk-build to build static binaries.
Ran into issues while linking a static binary targeting API 16 with the following error message:
ld: error: duplicate symbol: swprintf
>>> defined at swprintf.cpp:38 (/Volumes/Android/buildbot/src/android/ndk-release-r22/out/darwin/android-ndk-r22-beta1/sources/android/support/src/swprintf.cpp:38)
>>> swprintf.o:(swprintf) in archive /Volumes/Developer/android/sdk/ndk/magisk/sources/android/support/../../cxx-stl/llvm-libc++/libs/armeabi-v7a/libandroid_support.a
>>> defined at stdio.cpp:983 (bionic/libc/stdio/stdio.cpp:983)
>>> stdio.o:(.text.swprintf+0x1) in archive /Volumes/Developer/android/sdk/ndk/magisk/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/lib/arm-linux-androideabi/16/libc.a
ld: error: duplicate symbol: posix_memalign
>>> defined at posix_memalign.cpp:5 (/Volumes/Android/buildbot/src/android/ndk-release-r22/out/darwin/android-ndk-r22-beta1/sources/android/support/src/posix_memalign.cpp:5)
>>> posix_memalign.o:(posix_memalign) in archive /Volumes/Developer/android/sdk/ndk/magisk/sources/android/support/../../cxx-stl/llvm-libc++/libs/armeabi-v7a/libandroid_support.a
>>> defined at malloc_common.h:80 (bionic/libc/bionic/malloc_common.h:80)
>>> malloc_common.o:(.text.posix_memalign+0x1) in archive /Volumes/Developer/android/sdk/ndk/magisk/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/lib/arm-linux-androideabi/16/libc.a
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
It looks like there are duplicate symbols in libc.a and libandroid_support.a
Update: when changing the code to target API 21, the error disappears, which means the issue lies in API 16 static libs