Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libz.a for armv7a missing symbols #20

Closed
ghost opened this issue Feb 25, 2021 · 5 comments
Closed

libz.a for armv7a missing symbols #20

ghost opened this issue Feb 25, 2021 · 5 comments

Comments

@ghost
Copy link

ghost commented Feb 25, 2021

while compiling static binary with armv7a clang, facing some linker error regarding libz.a
cause of missing symbol

More details and probable fix can be found in this issue by topjohnwu: android/ndk#1391

in my case output:

root@kali:~/dump_source/simg2img# make  
              /root/android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi30-clang++ -std=gnu++17 -O2 -W -Wall -Werror -Wextra -ffunction-sections -O3 -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -Iinclude -Iandroid-base/include -c backed_block.cpp -o backed_block.o                                         /root/android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi30-clang++ -std=gnu++17 -O2 -W -Wall -Werror -Wextra -ffunction-sections -O3 -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -Iinclude -Iandroid-base/include -c output_file.cpp -o output_file.o
/root/android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi30-clang++ -std=gnu++17 -O2 -W -Wall -Werror -Wextra -ffunction-sections -O3 -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -Iinclude -Iandroid-base/include -c sparse.cpp -o sparse.o
/root/android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi30-clang++ -std=gnu++17 -O2 -W -Wall -Werror -Wextra -ffunction-sections -O3 -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -Iinclude -Iandroid-base/include -c sparse_crc32.cpp -o sparse_crc32.o
/root/android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi30-clang++ -std=gnu++17 -O2 -W -Wall -Werror -Wextra -ffunction-sections -O3 -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -Iinclude -Iandroid-base/include -c sparse_err.cpp -o sparse_err.o
/root/android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi30-clang++ -std=gnu++17 -O2 -W -Wall -Werror -Wextra -ffunction-sections -O3 -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -Iinclude -Iandroid-base/include -c sparse_read.cpp -o sparse_read.o
/root/android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi30-clang++ -std=gnu++17 -O2 -W -Wall -Werror -Wextra -ffunction-sections -O3 -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -Iinclude -Iandroid-base/include -c android-base/stringprintf.cpp -o android-base/stringprintf.o
/root/android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ar rc libsparse.a backed_block.o output_file.o sparse.o sparse_crc32.o sparse_err.o sparse_read.o android-base/stringprintf.o
/root/android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ranlib libsparse.a
/root/android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi30-clang++ -std=gnu++17 -O2 -W -Wall -Werror -Wextra -ffunction-sections -O3 -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -Iinclude -Iandroid-base/include -o simg2img simg2img.cpp -L. -lsparse -lm -lz -Wl,--gc-sections -s -static
/root/android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: /root/android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/lib/arm-linux-androideabi/30/libz.a(deflate.o): in function `deflateInit2_':
external/zlib/deflate.c:(.text.deflateInit2_+0x200): undefined reference to `arm_cpu_enable_crc32'
/root/android-ndk-r22/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: external/zlib/deflate.c:(.text.deflateInit2_+0x204): undefined reference to `x86_cpu_enable_simd'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Makefile:85: simg2img] Error 1
@lzhiyong
Copy link
Owner

lzhiyong commented Feb 27, 2021

The libz.a of armv7a lacks cpu_features.o and needs to be updated to r22b or above

@ghost
Copy link
Author

ghost commented Feb 27, 2021

The libz.a of armv7a lacks cpu_features.o and needs to be updated to r22b or above

I don't have pc and my mobile is not that great to compile the whole ndk.If you have time, can you fix it?

@lzhiyong
Copy link
Owner

Google has not released ndk-r22b, please wait for the r22b version to be released.

@ghost
Copy link
Author

ghost commented Feb 27, 2021

Google has not released ndk-r22b, please wait for the r22b version to be released.
i did not know.Thanks for the info.Closing the issue for now

@ghost ghost closed this as completed Feb 27, 2021
@ghost
Copy link
Author

ghost commented Mar 4, 2021

Google has not released ndk-r22b, please wait for the r22b version to be released.

By the way, i have fixed it in your current ndk release in r22

@ghost ghost reopened this Mar 4, 2021
@ghost ghost closed this as completed Mar 6, 2021
This issue was closed.
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

No branches or pull requests

1 participant