Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dlib-android crashes when built locally #13

Closed
stefan-girlich opened this issue Jul 13, 2016 · 9 comments
Closed

dlib-android crashes when built locally #13

stefan-girlich opened this issue Jul 13, 2016 · 9 comments

Comments

@stefan-girlich
Copy link

stefan-girlich commented Jul 13, 2016

I am currently trying to use dlib-android (rev d6e48c1) after building it via the default build command:
python build_push.py --android_project ../dlib-android-app/dlib/src/main/jniLibs/

(dlib-android-app is dlib-android-app at d6e48c1)

When not building dlib-android manually, the app behaves as expected. However, the app behaves as following after performing a (successful) build as shown above:

  1. Start app
  2. Click "Live preview" from bottom left.
  3. CameraActivity is started:
    • Title view remains empty; neither Copying landmark model nor time cost messages is shown
    • Floating video frame view with landmarks does not appear.
    • Application crashes after ~9sec.

Do you have any idea what could be the difference between your original build and my local one?
The original dlib board has an (unresolved) thread regarding this issue that relates to Android and possibly to dlib-android: https://sourceforge.net/p/dclib/discussion/442518/thread/b3ef5401/

Thanks a lot!

Crash log
Full log: 20160713_dlib-android_crash.txt

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'samsung/trltexx/trlte:5.1.1/LMY47X/N910FXXS1COK2:user/release-keys'
Revision: '12'
ABI: 'arm'
pid: 4292, tid: 4747, name: InferenceThread  >>> com.tzutalin.dlibtest <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
    r0 00000000  r1 0000128b  r2 00000006  r3 00000000
    r4 9c87bdb8  r5 00000006  r6 00000016  r7 0000010c
    r8 b4b4bb00  r9 a0349d30  sl 12c033d0  fp 9c878bb0
    ip 0000128b  sp 9c8789f0  lr b6e0771d  pc b6e2a2dc  cpsr 600f0010
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)
    #14 pc 0013c77f  /data/dalvik-cache/arm/data@app@com.tzutalin.dlibtest-1@base.apk@classes.dex

OS used for build

  • OSX 10.11.4 - Darwin myhostname 15.4.0 Darwin Kernel Version 15.4.0: Fri Feb 26 22:08:05 PST 2016; root:xnu-3248.40.184~3/RELEASE_X86_64 x86_64
  • or Linux debian 4.6.0-1-amd64 Landmark detection working in android? #1 SMP Debian 4.6.3-1 (2016-07-04) x86_64 GNU/Linux

Android device

  • Samsung Galaxy Note 4(SM-N910F)
  • Android 5.1.1
  • armeabi-v7
@tzutalin
Copy link
Owner

Hi @stefan-girlich ,
I pull the latest code from dlib-android 75a37aa and dlib-android-app, then I build it again. It works fine on my Android arm and x86 devices.

My build environment is as below:

OS used for build
  • Ubuntu 14.04
  • NDK Version : r10e
Android device
  • Android OS version: Android L and M device
  • ABI: armeabi-v7 and x86_64

Do you know what's your ndk version? If you connect to your devices, and execut $ python build_push.py --test, will it work without errors?

@stefan-girlich
Copy link
Author

Unfortunately python build_push.py --test fails for both NDK r10e and r12b; find the corresponding logs attached.

20160714_dlib-android_test_fail_r10e.txt
20160714_dlib-android_test_fail.txt

@tzutalin
Copy link
Owner

@stefan-girlich
That's so weird. The executable file or libraries you build are unable to run..

I never compiled it on OSX 10.11.4 before.

@smkirkpatrick
Copy link

@tzutalin @stefan-girlich Experiencing the same issue in this build env:

OS used for build

  • OSX 10.11.5
  • NDK Version : r12b

Android device

  • Android OS version: 5.1.1
  • ABI: armeabi-v7 (ARMv7 on LG Escape2 - lg-h443)

Building and running app attached to Android Studio

  • Android Studio 2.1.2 Build #AI-143.2915827
  • JRE: 1.6.0_65-b14-468-11M4833 x86_64

Same exception thrown on python build_push.py --test as well. Learn anything new or have suggestions for debugging?

@stefan-girlich
Copy link
Author

Simply not throwing the corresponding exception is feasible as a workaround, see comment in original discussion. Of course, this is means modifying dlib with unknown side effects.

@tzutalin
Copy link
Owner

I am wondering why it won't happen on ubuntu with ndk-linux. It happens on OSX with ndk-darwin

@stefan-girlich
Copy link
Author

stefan-girlich commented Jul 15, 2016

This is really quite mysterious, especially since I could also reproduce the crash when building on Debian GNU/Linux (see my original comment above).

Please note that I created a StackOverflow question for increased visibility: https://stackoverflow.com/questions/38391746/dlib-dlib-android-crashes-at-runtime-when-built-on-osx

@stefan-girlich
Copy link
Author

Big thanks to @e-fominov for providing a fix on StackOverflow! In a nutshell: Set NDK_DEBUG=0 in build_push.py:35.

@tzutalin , can you confirm that fix and the original issue on your local machine?

@tzutalin
Copy link
Owner

@stefan-girlich @e-fominov,
Thank you very much. By default, I will set NDK_DEBUG=0 to build.

If someone would like to build it with debug build, they need to specify "--debug" argument. e.g.
./build_push.py --debug

I have merged the change and verified it, and there is no error.
Chnage: 63a46e4#L51

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants