I'm trying to compile Opencv4.3 to crosscompile with Android but if I user "DBUILD_SHARED_LIBS=ON" I got an error when running make command.
Command:
[ 57%] Built target opencv_xphoto
[ 57%] Linking CXX shared library ../../lib/arm64-v8a/libopencv_dnn.so
../../3rdparty/lib/arm64-v8a/liblibprotobuf.a(common.cc.o): In function `google::protobuf::internal::DefaultLogHandler(google::protobuf::LogLevel, char const*, int, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)':
/home/filipe/Transferências/Opencv4.3/opencv-4.3.0/3rdparty/protobuf/src/google/protobuf/stubs/common.cc:142: undefined reference to `__android_log_write'
/home/filipe/Transferências/Opencv4.3/opencv-4.3.0/3rdparty/protobuf/src/google/protobuf/stubs/common.cc:150: undefined reference to `__android_log_write'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
modules/dnn/CMakeFiles/opencv_dnn.dir/build.make:2701: recipe for target 'lib/arm64-v8a/libopencv_dnn.so' failed
make[2]: *** [lib/arm64-v8a/libopencv_dnn.so] Error 1
CMakeFiles/Makefile2:3591: recipe for target 'modules/dnn/CMakeFiles/opencv_dnn.dir/all' failed
make[1]: *** [modules/dnn/CMakeFiles/opencv_dnn.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2
Error:
[ 57%] Built target opencv_xphoto
[ 57%] Linking CXX shared library ../../lib/arm64-v8a/libopencv_dnn.so
../../3rdparty/lib/arm64-v8a/liblibprotobuf.a(common.cc.o): In function `google::protobuf::internal::DefaultLogHandler(google::protobuf::LogLevel, char const*, int, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)':
/home/filipe/Transferências/Opencv4.3/opencv-4.3.0/3rdparty/protobuf/src/google/protobuf/stubs/common.cc:142: undefined reference to `__android_log_write'
/home/filipe/Transferências/Opencv4.3/opencv-4.3.0/3rdparty/protobuf/src/google/protobuf/stubs/common.cc:150: undefined reference to `__android_log_write'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
modules/dnn/CMakeFiles/opencv_dnn.dir/build.make:2701: recipe for target 'lib/arm64-v8a/libopencv_dnn.so' failed
make[2]: *** [lib/arm64-v8a/libopencv_dnn.so] Error 1
CMakeFiles/Makefile2:3591: recipe for target 'modules/dnn/CMakeFiles/opencv_dnn.dir/all' failed
make[1]: *** [modules/dnn/CMakeFiles/opencv_dnn.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2
If I use DBUILD_SHARED_LIBS=OFF this compile fine. What can I do? Any ideas?
Thanks