OpenCV/NDK - zlib compiling issues in android makefile -
i have been trying compile shared library includes opencv libraries. sample android make files below:
local_path := (call my-dir) include $(clear_vars) local_module := libopencvxxx local_src_files := libs/opencv/libopencvxxx.a include $(prebuilt_static_library) opencv_lib_type := static opencv_install_modules := on opencv_camera_modules := on local_module := libxxx local_cppflags := -std=c++11 -fexceptions local_cpp_features += exceptions local_cflags := -std=gnu++11 -fexceptions local_ldlibs := -llog -ldl local_src_files := xxx.cpp local_c_includes := <path opencv header files> local_static_libraries := stdc++ local_static_libraries += libopencvxxx include $(build_shared_library)
however, keeps throwing below errors:
[info] jni/libs/opencv/libopencv_core.a(persistence.cpp.o):persistence.cpp:function icvgets(cvfilestorage*, char*, int): error: undefined reference 'gzgets' [info] jni/libs/opencv/libopencv_core.a(persistence.cpp.o):persistence.cpp:function icvxmlskipspaces(cvfilestorage*, char*, int): error: undefined reference 'gzeof'
i tried several options below.
local_ldlibs += -lz local_ldlibs += -l<ndk root>/platforms/android-19/arch-arm/usr/lib -lz
but nothing helped. has clue how can fix this?
edit: forgot add when add these above 2 options including '-lz', throws error saying "no native compiled library found, did native compile complete successfully!".
i found issue. supposed add
include $(clear_vars)
after including static libraries. below corrected android.mk
local_path := (call my-dir) include $(clear_vars) local_module := libopencvxxx local_src_files := libs/opencv/libopencvxxx.a include $(prebuilt_static_library) include $(clear_vars) opencv_lib_type := static opencv_install_modules := on opencv_camera_modules := on local_module := libxxx local_cppflags := -std=c++11 -fexceptions local_cpp_features += exceptions local_cflags := -std=gnu++11 -fexceptions local_ldlibs := -llog -ldl local_src_files := xxx.cpp local_c_includes := <path opencv header files> local_static_libraries := stdc++ local_static_libraries += libopencvxxx include $(build_shared_library)
Comments
Post a Comment