build - compile dlib and opencv with android ndk -


i android developer, new android ndk, please help, or tell me else need/ how try solve type of problem.

i used this dlib android example , official opencv android library , integrate 2 in 1 application. when trying build project following error:

failure: build failed exception.  * went wrong: execution failed task ':opencvsamplefacedetection:externalnativebuilddebug'. > build command failed.   error while executing process /home/feli/android/sdk/ndk-bundle/ndk-build arguments {ndk_project_path=null app_build_script=/home/feli/development/android/test/face-detection/opencvsamplefacedetection/src/main/jni/android.mk ndk_application_mk=/home/feli/development/android/test/face-detection/opencvsamplefacedetection/src/main/jni/application.mk app_abi=mips64 ndk_all_abis=mips64 ndk_debug=1 app_platform=android-21 ndk_out=/home/feli/development/android/test/face-detection/opencvsamplefacedetection/build/intermediates/ndkbuild/debug/obj ndk_libs_out=/home/feli/development/android/test/face-detection/opencvsamplefacedetection/build/intermediates/ndkbuild/debug/lib /home/feli/development/android/test/face-detection/opencvsamplefacedetection/build/intermediates/ndkbuild/debug/obj/local/mips64/libdetection_based_tracker.so}   [mips64] compile++      : detection_based_tracker <= detectionbasedtracker_jni.cpp   [mips64] prebuilt       : libopencv_java3.so <= /home/feli/android/opencv/opencv-android-sdk/sdk/native/jni/../libs/mips64/   [mips64] sharedlibrary  : libdetection_based_tracker.so   /home/feli/development/android/test/face-detection/opencvsamplefacedetection/build/intermediates/ndkbuild/debug/obj/local/mips64/objs-debug/detection_based_tracker/detectionbasedtracker_jni.o: in function `dlib_check_consistent_assert_usage':   /home/feli/development/android/test/face-detection/opencvsamplefacedetection/src/main/jni/dlib/dlib/threads/threads_kernel_shared.h:44: undefined reference `user_error__missing_dlib_all_source_cpp_file__or__inconsistent_use_of_debug_or_enable_asserts_preprocessor_directives_'   clang++: error: linker command failed exit code 1 (use -v see invocation)   make: *** [/home/feli/development/android/test/face-detection/opencvsamplefacedetection/build/intermediates/ndkbuild/debug/obj/local/mips64/libdetection_based_tracker.so] error 1   * try: run --stacktrace option stack trace. run --info or --debug option more log output. 

my first guess haven/t included source.cpp in android.mk placeing src files didn't solve porblem. here android.mk:

local_path := $(call my-dir)  ## build dlib static library include $(clear_vars) local_module := dlib local_c_includes := $(local_path)/dlib  local_src_files += \                 $(local_path)/dlib/dlib/all/source.cpp \                 $(local_path)/dlib//dlib/threads/threads_kernel_shared.cpp \                 $(local_path)/dlib/dlib/entropy_decoder/entropy_decoder_kernel_2.cpp \                 $(local_path)/dlib/dlib/base64/base64_kernel_1.cpp \                 $(local_path)/dlib/dlib/threads/threads_kernel_1.cpp \                 $(local_path)/dlib/dlib/threads/threads_kernel_2.cpp  local_export_c_includes := $(local_c_includes) include $(build_static_library)  # build opencv include $(clear_vars) opencvroot := ~/android/opencv/opencv-android-sdk opencv_camera_modules:=on opencv_install_modules:=on opencv_lib_type := shared include ${opencvroot}/sdk/native/jni/opencv.mk  local_module     := detection_based_tracker local_c_includes += $(local_path) local_src_files  := detectionbasedtracker_jni.cpp  local_ldlibs     += -lm -llog -ldl -lz -ljnigraphics local_cppflags += -fexceptions -frtti -std=c++11  # local_static_libraries += dlib  include $(build_shared_library) 

maybe ndk_project_path=null problem? why 2 libraries building separately? or else can problem? tried lot modifying android.mk, it's working mystery me. or opinion useful.

edit:

when comment out local_static_libraries += dlib row, got following exception:

build command failed.   error while executing process /home/feli/android/sdk/ndk-bundle/ndk-build arguments {ndk_project_path=null app_build_script=/home/feli/development/android/test/face-detection/opencvsamplefacedetection/src/main/jni/android.mk ndk_application_mk=/home/feli/development/android/test/face-detection/opencvsamplefacedetection/src/main/jni/application.mk app_abi=mips64 ndk_all_abis=mips64 ndk_debug=1 app_platform=android-21 ndk_out=/home/feli/development/android/test/face-detection/opencvsamplefacedetection/build/intermediates/ndkbuild/debug/obj ndk_libs_out=/home/feli/development/android/test/face-detection/opencvsamplefacedetection/build/intermediates/ndkbuild/debug/lib /home/feli/development/android/test/face-detection/opencvsamplefacedetection/build/intermediates/ndkbuild/debug/obj/local/mips64/libdetection_based_tracker.so}   [mips64] compile++      : detection_based_tracker <= detectionbasedtracker_jni.cpp   [mips64] compile++      : dlib <= source.cpp   in file included /home/feli/development/android/test/face-detection/opencvsamplefacedetection/src/main/jni/dlib/dlib/all/source.cpp:76:   in file included /home/feli/development/android/test/face-detection/opencvsamplefacedetection/src/main/jni/dlib/dlib/all/../gui_widgets/fonts.cpp:14:   /home/feli/development/android/test/face-detection/opencvsamplefacedetection/src/main/jni/dlib/dlib/all/../gui_widgets/nativefont.h:27:10: fatal error: 'x11/xlib.h' file not found   #include <x11/xlib.h>            ^~~~~~~~~~~~   1 error generated.   make: *** [/home/feli/development/android/test/face-detection/opencvsamplefacedetection/build/intermediates/ndkbuild/debug/obj/local/mips64/objs-debug/dlib//home/feli/development/android/test/face-detection/opencvsamplefacedetection/src/main/jni/dlib/dlib/all/source.o] error 1 

dlib uses cmake, , not trivial setup. may take long time experience professional prepare ndk-build scripts library.

i suggest build native library cmake, instead of ndk-build. can find example of native library uses opencv on github.

also, suggest start abifilters set 1 relevant abi, , when see works you, can build project other abis. remember libraries porting abis may tricky. , if don't have platform perform @ least brief sanity check abi, there no sense in building it.


Comments

Popular posts from this blog

Add new key value to json node in java -

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

javascript - Highcharts Synchronized charts with missing data points -