Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Building Opencv4.3 Android shared libs error

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

Building Opencv4.3 Android shared libs error

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
~/Android/Sdk/cmake/3.6.4111459/bin/cmake .. -DANDROID_ABI=arm64-v8a -DANDROID_NATIVE_API_LEVEL=23 -DANDROID_ARM_NEON=ON -DANDROID_TOOLCHAIN=clang -DCMAKE_TOOLCHAIN_FILE=/home/filipe/Android/Sdk/ndk-bundle/build/cmake/android.toolchain.cmake -DANDROID_NDK=/home/filipe/Android/Sdk/ndk-bundle -DANDROID_SDK=/home/filipe/Android/Sdk -DCMAKE_BUILD_TYPE=Release -DBUILD_ANDROID_PROJECTS=OFF -DWITH_OPENCL=ON -DWITH_TBB=ON -DENABLE_NEON=ON -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DOPENCV_EXTRA_MODULES_PATH=/home/filipe/Transferências/Opencv4.3/opencv_contrib-4.3.0/modules -DINSTALL_ANDROID_EXAMPLES=OFF -DANDROID_EXAMPLES_WITH_LIBS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_DOCS=OFF -DWITH_IPP=ON -DANDROID_STL=c++_shared -DBUILD_SHARED_LIBS=ON -DBUILD_ANDROID_EXAMPLES=OFF -DANDROID_SDK_TARGET=21 -DBUILD_ZLIB=ON

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

Building Opencv4.3 Android shared libs error

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:

~/Android/Sdk/cmake/3.6.4111459/bin/cmake .. -DANDROID_ABI=arm64-v8a -DANDROID_NATIVE_API_LEVEL=23 -DANDROID_ARM_NEON=ON -DANDROID_TOOLCHAIN=clang -DCMAKE_TOOLCHAIN_FILE=/home/filipe/Android/Sdk/ndk-bundle/build/cmake/android.toolchain.cmake -DANDROID_NDK=/home/filipe/Android/Sdk/ndk-bundle -DANDROID_SDK=/home/filipe/Android/Sdk -DCMAKE_BUILD_TYPE=Release -DBUILD_ANDROID_PROJECTS=OFF -DWITH_OPENCL=ON -DWITH_TBB=ON -DENABLE_NEON=ON -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DOPENCV_EXTRA_MODULES_PATH=/home/filipe/Transferências/Opencv4.3/opencv_contrib-4.3.0/modules -DINSTALL_ANDROID_EXAMPLES=OFF -DANDROID_EXAMPLES_WITH_LIBS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_DOCS=OFF -DWITH_IPP=ON -DANDROID_STL=c++_shared -DBUILD_SHARED_LIBS=ON -DBUILD_ANDROID_EXAMPLES=OFF -DANDROID_SDK_TARGET=21 -DBUILD_ZLIB=ON

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