0

I have an Android Application that uses the NDK. In my C++ code I have a call to std::use_facet(). On its own my application runs fine however when I add the ACRCloud SDK I get a crash right when I launch my app:

Build fingerprint: 'google/taimen/taimen:9/PPR2.180905.005/4928864:user/release-keys'
2018-10-17 14:48:36.357 2938-2938/? A/DEBUG: Revision: 'rev_10'
2018-10-17 14:48:36.357 2938-2938/? A/DEBUG: ABI: 'arm'
2018-10-17 14:48:36.357 2938-2938/? A/DEBUG: pid: 2915, tid: 2915, name: .app  >>> com.mycompany.android.app <<<
2018-10-17 14:48:36.357 2938-2938/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
2018-10-17 14:48:36.357 2938-2938/? A/DEBUG: Cause: null pointer dereference
2018-10-17 14:48:36.357 2938-2938/? A/DEBUG:     r0  00000000  r1  00000043  r2  d5b21700  r3  00000000
2018-10-17 14:48:36.357 2938-2938/? A/DEBUG:     r4  ffd1a974  r5  ebd856ac  r6  ebd856ac  r7  d551c3a4
2018-10-17 14:48:36.357 2938-2938/? A/DEBUG:     r8  d3acfae8  r9  f45842c0  r10 00000143  r11 ffd1a9b4
2018-10-17 14:48:36.357 2938-2938/? A/DEBUG:     ip  00000000  sp  ffd1a948  lr  d473ae40  pc  d473ae54
2018-10-17 14:48:36.550 2938-2938/? A/DEBUG: backtrace:
2018-10-17 14:48:36.550 2938-2938/? A/DEBUG:     #00 pc 03e2fe54  /data/app/com.mycompany.android.app-APqEWGjyWJxWwxYs8NNiHA==/lib/arm/libMyApp.so (std::ctype<char> const& std::use_facet<std::ctype<char>>(std::locale const&)+40)
2018-10-17 14:48:36.550 2938-2938/? A/DEBUG:     #01 pc 023ee45c  /data/app/com.mycompany.android.app-APqEWGjyWJxWwxYs8NNiHA==/lib/arm/libMyApp.so (_ZNSt8__detail9_CompilerISt12regex_traitsIcEEC1EPKcS5_RKS2_NSt15regex_constants18syntax_option_typeE+232)
2018-10-17 14:48:36.550 2938-2938/? A/DEBUG:     #02 pc 023eb19c  /data/app/com.mycompany.android.app-APqEWGjyWJxWwxYs8NNiHA==/lib/arm/libMyApp.so (_ZNSt8__detail13__compile_nfaISt12regex_traitsIcEEESt10shared_ptrINS_4_NFAIT_EEEPKNS5_9char_typeESA_RKS5_NSt15regex_constants18syntax_option_typeE+80)
2018-10-17 14:48:36.550 2938-2938/? A/DEBUG:     #03 pc 023e8d28  /data/app/com.mycompany.android.app-APqEWGjyWJxWwxYs8NNiHA==/lib/arm/libMyApp.so (_ZNSt11basic_regexIcSt12regex_traitsIcEEC2IPKcEET_S6_NSt15regex_constants18syntax_option_typeE+240)

The crash shows up in my native library but I believe it is something to do with the ACRCloud library being in there that is causing this.

Note that at the point of the crash there is no code running yet that instantiates any of the ACRCloud SDK.

My gut feeling is that ACRCloud is also using the same method call somewhere, std::use_facet(), and during compilation the symbols from ACRCloud are being brought in instead of mine and that is somehow causing a conflict.

Perhaps someone at ACRCloud can chime in.

Przemek Lach
  • 1,348
  • 2
  • 19
  • 42

2 Answers2

0

This crash is caused by “/lib/arm/libMyApp.so”. It may be your own library. ACRCloud SDK does not contain this library.

Tony Li
  • 95
  • 5
0

So turns out my build setup was incorrect. I'm using Bazel to build everything and I was referencing the ACRCloud library using a cc_library rule rather than what it should have been: filegroup.

I think when I used cc_library rule something was being modified during compilation and that led to my error; whereas, if I import it via filegroup the artifact will just be brought in without being touched in any way.

Przemek Lach
  • 1,348
  • 2
  • 19
  • 42