I am missing quite a few references:
libopencv_imgproc.a(filter.dispatch.cpp.o):filter.dispatch.cpp:function cv::preprocess2DKernel(cv::Mat const&, std::__ndk1::vector<cv::Point_<int>, std::__ndk1::allocator<cv::Point_<int> > >&, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> >&): error: undefined reference to 'cv::countNonZero(cv::_InputArray const&)'
This is the build:
Build command failed.
Error while executing process /home/x/Android/Sdk/cmake/3.10.2.4988404/bin/ninja with arguments {-C /home/x/Documentos/temp/OpenCVstatictest2/application/app/.cxx/cmake/debug/armeabi-v7a native-lib}
ninja: Entering directory `/home/x/Documentos/temp/OpenCVstatictest2/application/app/.cxx/cmake/debug/armeabi-v7a'
[1/3] Building CXX object CMakeFiles/native-lib.dir/native-lib.cpp.o
[2/3] Building CXX object CMakeFiles/native-lib.dir/find-cut-squares.cpp.o
[3/3] Linking CXX shared library /home/x/Documentos/temp/OpenCVstatictest2/application/app/build/intermediates/cmake/debug/obj/armeabi-v7a/libnative-lib.so
FAILED: /home/x/Documentos/temp/OpenCVstatictest2/application/app/build/intermediates/cmake/debug/obj/armeabi-v7a/libnative-lib.so
: && /home/x/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=armv7-none-linux-androideabi21 --gcc-toolchain=/home/x/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/x/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security -std=c++17 -frtti -fexceptions -O0 -fno-limit-debug-info -Wl,--exclude-libs,libgcc_real.a -Wl,--exclude-libs,libatomic.a -static-libstdc++ -Wl,--build-id -Wl,--fatal-warnings -Wl,--exclude-libs,libunwind.a -Wl,--no-undefined -Qunused-arguments -shared -Wl,-soname,libnative-lib.so -o /home/x/Documentos/temp/OpenCVstatictest2/application/app/build/intermediates/cmake/debug/obj ...
I am building on ndk statically CMakeLists.txt:
cmake_minimum_required(VERSION 3.4.1)
set(OpenCV_STATIC ON)
include_directories(${OpenCV_DIR}/jni/include)
set(STATIC_LIBS "${OpenCV_DIR}/staticlibs/${ANDROID_ABI}")
file(GLOB STUFF RELATIVE ${STATIC_LIBS} ${STATIC_LIBS}/*.a)
message(STATUS "OpenCV libs: ${STUFF}")
foreach(lib ${STUFF})
add_library( ${lib} STATIC IMPORTED )
set_target_properties(${lib} PROPERTIES IMPORTED_LOCATION ${STATIC_LIBS}/${lib})
endforeach()
set(STATIC_LIBS_OTHER "${OpenCV_DIR}/3rdparty/libs/${ANDROID_ABI}")
file(GLOB STUFF_OTHER RELATIVE ${STATIC_LIBS_OTHER} ${STATIC_LIBS_OTHER}/*.a)
message(STATUS "3rd party libs: ${STUFF_OTHER}")
foreach(lib_other ${STUFF_OTHER})
add_library( ${lib_other} STATIC IMPORTED )
set_target_properties(${lib_other} PROPERTIES IMPORTED_LOCATION ${STATIC_LIBS_OTHER}/${lib_other})
endforeach()
add_library( native-lib SHARED native-lib.cpp find-cut-squares.cpp find-cut-squares.hpp)
find_library(
log-lib
log
)
target_link_libraries(
native-lib
${STUFF}
${STUFF_OTHER}
z
${log-lib}
)