Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Error to cross compile into arm64-v8a in Windows 10

I use CMake-GUI with Newest NDK 21.2.6472646

[ 98%] Built target gen_opencv_java_source
[ 98%] Linking CXX shared module ..\..\..\jni\arm64-v8a\libopencv_java4.so
..\..\..\lib\arm64-v8a\libopencv_core.a: error adding symbols: Archive has no index; run ranlib to add one
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
mingw32-make[2]: *** [modules\java\jni\CMakeFiles\opencv_java.dir\build.make:281: jni/arm64-v8a/libopencv_java4.so] Error 1

Which option do I need to add or remove?

Error to cross compile into arm64-v8a in Windows 10

I use CMake-GUI with Newest NDK 21.2.6472646

[ 98%] Built target gen_opencv_java_source
[ 98%] Linking CXX shared module ..\..\..\jni\arm64-v8a\libopencv_java4.so
..\..\..\lib\arm64-v8a\libopencv_core.a: error adding symbols: Archive has no index; run ranlib to add one
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
mingw32-make[2]: *** [modules\java\jni\CMakeFiles\opencv_java.dir\build.make:281: jni/arm64-v8a/libopencv_java4.so] Error 1

Which option do I need to add or remove?

Error to cross compile into arm64-v8a in Windows 10by CV 4.3.0

I use CMake-GUI with Newest NDK 21.2.647264621.2.6472646 on Windows 10. If I remove BUILD_opencv_java, CMake will finish.

[ 98%] Built target gen_opencv_java_source
[ 98%] Linking CXX shared module ..\..\..\jni\arm64-v8a\libopencv_java4.so
..\..\..\lib\arm64-v8a\libopencv_core.a: error adding symbols: Archive has no index; run ranlib to add one
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
mingw32-make[2]: *** [modules\java\jni\CMakeFiles\opencv_java.dir\build.make:281: jni/arm64-v8a/libopencv_java4.so] Error 1

Which option do I need to add or remove?

Error to cross compile into arm64-v8a by CV 4.3.0

I use CMake-GUI with Newest NDK 21.2.6472646 on Windows 10. If I remove BUILD_opencv_java, CMake will finish.

[ 98%] Built target gen_opencv_java_source
[ 98%] Linking CXX shared module ..\..\..\jni\arm64-v8a\libopencv_java4.so
..\..\..\lib\arm64-v8a\libopencv_core.a: error adding symbols: Archive has no index; run ranlib to add one
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
mingw32-make[2]: *** [modules\java\jni\CMakeFiles\opencv_java.dir\build.make:281: jni/arm64-v8a/libopencv_java4.so] Error 1

Which option do After 12 hours, I need knew how to add or remove?fix it.

@echo off
rem Please replace command with your ranlib at %NDK Path%/toolchains/llvm/prebuilt/windows-x86_64/bin/
C:/Users/Homan/AppData/Local/Android/Sdk/ndk/21.2.6472646/toolchains/llvm/prebuilt/windows-x86_64/bin/aarch64-linux-android-ranlib.exe %1 %2 %3 %4
echo "Fixed %1"

Here is my fix.bat. Please replace the exe file with your ranlib.exe.

Error to cross compile into arm64-v8a by CV 4.3.0

I use CMake-GUI with Newest NDK 21.2.6472646 on Windows 10. If I remove BUILD_opencv_java, CMake will finish.

[ 98%] Built target gen_opencv_java_source
[ 98%] Linking CXX shared module ..\..\..\jni\arm64-v8a\libopencv_java4.so
..\..\..\lib\arm64-v8a\libopencv_core.a: error adding symbols: Archive has no index; run ranlib to add one
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
mingw32-make[2]: *** [modules\java\jni\CMakeFiles\opencv_java.dir\build.make:281: jni/arm64-v8a/libopencv_java4.so] Error 1

After 12 hours, I knew how to fix it.

@echo off
rem Please replace command with your ranlib at %NDK Path%/toolchains/llvm/prebuilt/windows-x86_64/bin/
C:/Users/Homan/AppData/Local/Android/Sdk/ndk/21.2.6472646/toolchains/llvm/prebuilt/windows-x86_64/bin/aarch64-linux-android-ranlib.exe %1 %2 %3 %4
echo "Fixed %1"

Here is my fix.bat. Please replace the exe file with your ranlib.exe.ranlib.exe. You can check my OpenCV note on Medium.com. Part 8, section 6-1 for detail.