I try to compile for ARM 32bit a C project, which contains links to zlib & minizip static libraries. I work with CLion IDE on Ubuntu 20. I had installed toolchain:
sudo apt-get install gcc-arm-linux-gnueabihf
Then I downloaded ARM deb packages, from which I extracted libz.a & libminizip.a:
zlib1g-dev_1.2.11.dfsg-2ubuntu1_armhf.deb
libminizip-dev_1.1-8build1_armhf.deb
Then I try to compile, but have:
====================[ Build | all | Default-System ]============================
/home/user/external/clion-2023.1.1/bin/cmake/linux/x64/bin/cmake --build /home/user/Clion/myproject/cmake-build-default-system --target all -j 1
[3/3] Linking C executable updater
FAILED: updater
: && /usr/bin/arm-linux-gnueabihf-gcc -fsanitize=address CMakeFiles/updater.dir/main.c.o CMakeFiles/updater.dir/base64.c.o -o updater /home/user/Clion/myproject/lib/arm/libz.a /home/user/Clion/myproject/lib/arm/libminizip.a /home/user/Clion/myproject/lib/arm/libjansson.a && :
/usr/lib/gcc-cross/arm-linux-gnueabihf/9/../../../../arm-linux-gnueabihf/bin/ld: /home/user/Clion/myproject/lib/arm/libminizip.a(unzip.o): in function «unzReadCurrentFile»:
(.text+0x144e): undefined link to «crc32»
Here is CmakeLists.txt:
cmake_minimum_required(VERSION 3.17)
project(updater C)
set(CMAKE_C_STANDARD 99)
add_executable(updater main.c unpack.h)
set(ZLIB_INCLUDE_DIR /home/user/Clion/myproject/zlib-arm/include)
set(ZLIB_LIBRARY /home/user/Clion/myproject/lib/arm/libz.a)
set(MINIZIP_LIBRARY /home/user/Clion/myproject/lib/arm/libminizip.a)
target_include_directories(updater PRIVATE ${ZLIB_INCLUDE_DIR})
target_link_libraries(updater PRIVATE ${ZLIB_LIBRARY})
target_link_libraries(updater PRIVATE ${MINIZIP_LIBRARY})
The survey of the libz.a seems OK:
nm /home/user/Clion/myproject/lib/arm/libz.a | grep crc32
crc32.o:
00000645 T crc32
0000064d T crc32_combine
00000481 t crc32_combine_
00000651 T crc32_combine64
00000001 t crc32_little
0000063d T crc32_z
U crc32
U crc32
I suspect that downloaded libraries might be incompatible. But what to replace them with? Or build them manually - but how? Any advice?