You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] libz.a for armeabi-v7a is missing symbols #1391
Using NDK r22-beta1 (22.0.6917172-beta1) on macOS with ndk-build to build static binaries.
When statically linking libz.a in 32 bit ARM code, the linker will complain with the following error:
ld: error: undefined symbol: arm_cpu_enable_crc32
>>> referenced by deflate.c:0 (external/zlib/deflate.c:0)
>>> deflate.o:(deflateInit2_) in archive /Volumes/Developer/android/sdk/ndk/magisk/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/lib/arm-linux-androideabi/21/libz.a
ld: error: undefined symbol: x86_cpu_enable_simd
>>> referenced by deflate.c:0 (external/zlib/deflate.c:0)
>>> deflate.o:(deflateInit2_) in archive /Volumes/Developer/android/sdk/ndk/magisk/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/lib/arm-linux-androideabi/21/libz.a
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
Using readelf to print out symbols of all libz.a for arm 32, it seems all libz.a archives are missing cpu_features.o, causing the following symbols to be undefined:
int arm_cpu_enable_crc32;
int arm_cpu_enable_pmull;
int x86_cpu_enable_sse2;
int x86_cpu_enable_ssse3;
int x86_cpu_enable_simd;
This issue does not happen on any other arch.
Reacted by Violet Giraffe, LoveSy, kitten23, LWY and Sergei Solodovnikov
// This file doesn't build for non-neon, so it can't be in the main srcs.
"cpu_features.c",
i've just done an upstream update anyway so i'll have a look and see if that's actually/still true. (things might get a bit interesting if non-neon is just not supported, but we can always hack in some stubs.)
external/zlib/cpu_features.c:56:13: error: function '_cpu_check_features' has internal linkage but is not defined [-Werror,-Wundefined-internal]
static void _cpu_check_features(void);
^
external/zlib/cpu_features.c:70:42: note: used here
pthread_once(&cpu_check_inited_once, _cpu_check_features);
^
1 error generated.
...but playing with the CPU_NO_SIMD #define seems to work. i've uploaded a new patchset to the same CL.
Activity
enh-google commentedon Dec 7, 2020
hmm. i wrote this in the Android.bp:
i've just done an upstream update anyway so i'll have a look and see if that's actually/still true. (things might get a bit interesting if non-neon is just not supported, but we can always hack in some stubs.)
works for me locally, but iirc i need to let treehugger actually do an NDK build to hit the non-neon case anyway: https://android-review.googlesource.com/c/platform/external/zlib/+/1519998
enh-google commentedon Dec 8, 2020
okay, the obvious "let's just build it" failed:
...but playing with the
CPU_NO_SIMD#define seems to work. i've uploaded a new patchset to the same CL.hhb commentedon Jan 29, 2021
Prebuilt updated in
https://android-review.googlesource.com/c/platform/prebuilts/ndk/+/1564881
Update NDK to r22b
Bump to NDK r22b (#5780)
The NDK non-neon libz.a needs cpu_features.c symbols.
Target 64-bit Android architectures only to avoid zlib linking issues
ci(android): cap API level at 34 and cover Swift 6.3 + 6.4-nightly
ci(android): cap API level at 34 and cover Swift 6.3 + 6.4-nightly
ci(android): cap API level at 34 and cover Swift 6.3 + 6.4-nightly (#131
v1.0.0 (#133)
v1.0.0 (#133)
v1.0.0-alpha.1 (#133)