2

I am currently trying to build and use the dlib-android library which aims to port dlib to Android. Building is successful; but when using the compiled shared C++ library in the corresponding demo project dlib-android-app, the app crashes when starting to invoke library functions through JNI.

This runtime crash occurs for any build I perform locally, using an arbitrary NDK version on OSX or Debian. However, the crash cannot be reproduced using the pre-built version of dlib-android that is contained in the dlib-android-app project. Also, the project maintainer states that he cannot reproduce the issue.

What factors could cause my local builds to turn out erroneous on two different operating systems while the project maintainer can create a functional build using the same codebase and build procedure? Could it be that global compiler flags could cause this issue?

Resources

Stack trace

backtrace:
    #00 pc 000372dc  /system/lib/libc.so (tgkill+12)
    #01 pc 00014719  /system/lib/libc.so (pthread_kill+52)
    #02 pc 00015337  /system/lib/libc.so (raise+10)
    #03 pc 00011bd1  /system/lib/libc.so (__libc_android_abort+36)
    #04 pc 00010044  /system/lib/libc.so (abort+4)
    #05 pc 0046a103  /data/app/com.tzutalin.dlibtest-1/lib/arm/libpeople_det.so (__gnu_cxx::__verbose_terminate_handler()+226)
    #06 pc 00433dc9  /data/app/com.tzutalin.dlibtest-1/lib/arm/libpeople_det.so (__cxxabiv1::__terminate(void (*)())+4)
    #07 pc 00433e3d  /data/app/com.tzutalin.dlibtest-1/lib/arm/libpeople_det.so (std::terminate()+8)
    #08 pc 00433f61  /data/app/com.tzutalin.dlibtest-1/lib/arm/libpeople_det.so (__cxa_throw+120)
    #09 pc 00150a9c  /data/app/com.tzutalin.dlibtest-1/lib/arm/libpeople_det.so (dlib::compress_stream_kernel_1<dlib::entropy_encoder_model_kernel_5<257ul, dlib::entropy_encoder_kernel_2, 200000ul, 4ul>, dlib::entropy_decoder_model_kernel_5<257ul, dlib::entropy_decoder_kernel_2, 200000ul, 4ul>, dlib::crc32>::decompress(std::istream&, std::ostream&) const+544)
    #10 pc 00150478  /data/app/com.tzutalin.dlibtest-1/lib/arm/libpeople_det.so (dlib::get_serialized_frontal_faces()+63512)
    #11 pc 00140654  /data/app/com.tzutalin.dlibtest-1/lib/arm/libpeople_det.so (dlib::get_frontal_face_detector()+44)
    #12 pc 0013544c  /data/app/com.tzutalin.dlibtest-1/lib/arm/libpeople_det.so (DLibHOGFaceDetector::det(cv::Mat const&)+236)
    #13 pc 000e8d30  /data/app/com.tzutalin.dlibtest-1/lib/arm/libpeople_det.so (Java_com_tzutalin_dlib_PeopleDet_jniBitmapFaceDect+868)

1 Answers1

2

There are several related posts about this (similar) problem: C++ Debug builds broke in Snow Leopard X-Code Xcode 3.2.1 and C++ string fails!

when running python build_push.py - it will build

ret = subprocess.call(['ndk-build', '-j4', 'NDK_LOG=1', 'NDK_DEBUG=1', 'V=0'])

this means building Debug version (described here)

NDK_DEBUG=1 Force a debuggable build (see Table 1).

NDK_DEBUG=0 Force a release build (see Table 1).

consider changing build_push.py script with NDK_DEBUG=0

Community
  • 1
  • 1
Evgeniy
  • 2,481
  • 14
  • 24