I'm encounting linking error if I use NDK 26.0.10792818 using LLVM 17 to compile my project with Crypto 8.8, but it works fine with NDK 25.2.9519653 using LLVM 14.
F:/Mobile-Modding/App-Project//jni/cryptopp/arm64-v8a/libcryptopp.a -latomic -target aarch64-none-linux-android22 -no-canonical-prefixes -Wl,--gc-sections -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--exclude-libs,ALL -Wl,--gc-sections -Wl,--strip-all, -llog -static-libstdc++ -Wl,--no-undefined -Wl,--fatal-warnings -Wl,--no-undefined-version -llog -landroid -lz -lGLESv2 -lc -lm -o F:\Mobile-Modding\App-Project\/obj/local/arm64-v8a/libab.so
ld.lld: error: F:/Mobile-Modding/App-Project//jni/cryptopp/arm64-v8a/libcryptopp.a(chacha_avx.o) is incompatible with aarch64linux
ld.lld: error: F:/Mobile-Modding/App-Project//jni/cryptopp/arm64-v8a/libcryptopp.a(donna_sse.o) is incompatible with aarch64linux
ld.lld: error: F:/Mobile-Modding/App-Project//jni/cryptopp/arm64-v8a/libcryptopp.a(lsh256_avx.o) is incompatible with aarch64linux
ld.lld: error: F:/Mobile-Modding/App-Project//jni/cryptopp/arm64-v8a/libcryptopp.a(lsh256_sse.o) is incompatible with aarch64linux
ld.lld: error: F:/Mobile-Modding/App-Project//jni/cryptopp/arm64-v8a/libcryptopp.a(lsh512_avx.o) is incompatible with aarch64linux
ld.lld: error: F:/Mobile-Modding/App-Project//jni/cryptopp/arm64-v8a/libcryptopp.a(lsh512_sse.o) is incompatible with aarch64linux
ld.lld: error: F:/Mobile-Modding/App-Project//jni/cryptopp/arm64-v8a/libcryptopp.a(sse_simd.o) is incompatible with aarch64linux
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [D:/AndroidSDK/ndk/26.0.10792818/build/../build/core/build-binary.mk:654: F:\Mobile-Modding\App-Project\/obj/local/arm64-v8a/libab.so] Error 1
PS F:\Mobile-Modding\App-Project> ./compile26
[arm64-v8a] SharedLibrary : libab.so
ld.lld: error: F:/Mobile-Modding/App-Project//jni/cryptopp/arm64-v8a/libcryptopp.a(chacha_avx.o) is incompatible with aarch64linux
ld.lld: error: F:/Mobile-Modding/App-Project//jni/cryptopp/arm64-v8a/libcryptopp.a(donna_sse.o) is incompatible with aarch64linux
ld.lld: error: F:/Mobile-Modding/App-Project//jni/cryptopp/arm64-v8a/libcryptopp.a(lsh256_avx.o) is incompatible with aarch64linux
ld.lld: error: F:/Mobile-Modding/App-Project//jni/cryptopp/arm64-v8a/libcryptopp.a(lsh256_sse.o) is incompatible with aarch64linux
ld.lld: error: F:/Mobile-Modding/App-Project//jni/cryptopp/arm64-v8a/libcryptopp.a(lsh512_avx.o) is incompatible with aarch64linux
ld.lld: error: F:/Mobile-Modding/App-Project//jni/cryptopp/arm64-v8a/libcryptopp.a(lsh512_sse.o) is incompatible with aarch64linux
ld.lld: error: F:/Mobile-Modding/App-Project//jni/cryptopp/arm64-v8a/libcryptopp.a(sse_simd.o) is incompatible with aarch64linux
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [D:/AndroidSDK/ndk/26.0.10792818/build/../build/core/build-binary.mk:654: F:\Mobile-Modding\App-Project\/obj/local/arm64-v8a/libab.so] Error 1
make: *** Waiting for unfinished jobs....
[armeabi-v7a] SharedLibrary : libab.so
ld.lld: error: F:/Mobile-Modding/App-Project//jni/cryptopp/armeabi-v7a/libcryptopp.a(chacha_avx.o) is incompatible with armelf_linux_eabi
ld.lld: error: F:/Mobile-Modding/App-Project//jni/cryptopp/armeabi-v7a/libcryptopp.a(donna_sse.o) is incompatible with armelf_linux_eabi
ld.lld: error: F:/Mobile-Modding/App-Project//jni/cryptopp/armeabi-v7a/libcryptopp.a(lsh256_avx.o) is incompatible with armelf_linux_eabi
ld.lld: error: F:/Mobile-Modding/App-Project//jni/cryptopp/armeabi-v7a/libcryptopp.a(lsh256_sse.o) is incompatible with armelf_linux_eabi
ld.lld: error: F:/Mobile-Modding/App-Project//jni/cryptopp/armeabi-v7a/libcryptopp.a(lsh512_avx.o) is incompatible with armelf_linux_eabi
i
ld.lld: error: F:/Mobile-Modding/App-Project//jni/cryptopp/armeabi-v7a/libcryptopp.a(sse_simd.o) is incompatible with armelf_linux_eabi
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [D:/AndroidSDK/ndk/26.0.10792818/build/../build/core/build-binary.mk:654: F:\Mobile-Modding\App-Project\/obj/local/armeabi-v7a/libab.so] Error 1
This is how I add static lib to Android.mk
include $(CLEAR_VARS)
LOCAL_MODULE := cryptopp
LOCAL_SRC_FILES := cryptopp/$(TARGET_ARCH_ABI)/libcryptopp.a
include $(PREBUILT_STATIC_LIBRARY)
LOCAL_STATIC_LIBRARIES := libcurl libssl libcrypto cryptopp # dobby
I compiled the static lib libcryptopp.a with NDK 26.0.10792818 on Linux Mint 21. I tried to compile using NDK 25.2.9519653, it make no difference
This is my script to compile libs
for arch in armeabi-v7a arm64-v8a x86 x86_64
do
source ./TestScripts/setenv-android.sh 22 $arch
if [ "$?" -eq "0" ]; then
make -j4 -f GNUmakefile-cross distclean
make -j4 -f GNUmakefile-cross static dynamic
sudo make -j4 -f GNUmakefile-cross install PREFIX=/usr/local/cryptopp/android-$arch
mkdir -p ./lib/$arch && cp -rf ./libcryptopp.a ./lib/$arch/libcryptopp.a
fi
done