Repository: pytorch
Issue: [Caffe2] android app crashed while linked with libcaffe2_detectron_ops.so
Labels: caffe2

## 🐛 Bug
I built caffe2 libraries form source codes by scirpt/build_android.sh. My android project with c++ native libraries can successfully run when linked with libcaffe2.a, libprotobuf.a, and  any other generated libraries except libcaffe2_detectron_ops.so. 
When the project linked with libcaffe2_detectron_ops.so, it can be successfully built and started, but it crashed while android Opening NativeLibrary. 
Caffe2 is now in rapid development and APIs are changing frequently, but there is almost no useful up-to-date example or user guide for reference. So I have a question,  can we use libcaffe2_detectron_ops.so in android till now? 
Appreciate your help.

here are the call stack traces:
> syscall 0x00007be1a78a8b98
abort 0x00007be1a78ab776
ifree 0x00007be1a793457d
je_free 0x00007be1a7934681
__gnu_cxx::new_allocator<char>::deallocate(char*, unsigned long) 0x00007be10e7deee2
std::string::_Rep::_M_destroy(std::allocator<char> const&) 0x00007be10e7deedd
std::string::_Rep::_M_dispose(std::allocator<char> const&) 0x00007be10e7deedd
std::string::assign(std::string const&) 0x00007be10e7deec0
std::string::operator=(std::string const&) basic_string.h:555
c10::Registry<std::string, std::unique_ptr<caffe2::OperatorBase, std::default_delete<caffe2::OperatorBase> >, caffe2::OperatorDef const&, caffe2::Workspace*>::Register(std::string const&, std::function<std::unique_ptr<caffe2::OperatorBase, std::default_delete<caffe2::OperatorBase> > (caffe2::OperatorDef const&, caffe2::Workspace*)>, std::string const&, c10::RegistryPriority) Registry.h:106
c10::Registerer<std::string, std::unique_ptr<caffe2::OperatorBase, std::default_delete<caffe2::OperatorBase> >, caffe2::OperatorDef const&, caffe2::Workspace*>::Registerer(std::string const&, c10::Registry<std::string, std::unique_ptr<caffe2::OperatorBase, std::default_delete<caffe2::OperatorBase> >, caffe2::OperatorDef const&, caffe2::Workspace*>*, std::function<std::unique_ptr<caffe2::OperatorBase, std::default_delete<caffe2::OperatorBase> > (caffe2::OperatorDef const&, caffe2::Workspace*)>, std::string const&) Registry.h:168
__cxx_global_var_init.1 batch_permutation_op.cc:31
_GLOBAL__sub_I_batch_permutation_op.cc batch_permutation_op.cc:0
__dl__ZL10call_arrayIPFviPPcS1_EEvPKcPT_mbS5_ 0x00007be1aa5f3ad0
__dl__ZN6soinfo17call_constructorsEv 0x00007be1aa5f3d0d
__dl__ZN6soinfo17call_constructorsEv 0x00007be1aa5f3bf9
__dl__Z9do_dlopenPKciPK17android_dlextinfoPKv 0x00007be1aa5dd84c
__dl___loader_android_dlopen_ext 0x00007be1aa5d8f8a
android::OpenNativeLibrary(_JNIEnv*, int, char const*, _jobject*, _jstring*, bool*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*) 0x00007be1a7991fa6
art::JavaVMExt::LoadNativeLibrary(_JNIEnv*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, _jobject*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*) 0x00007be124a7a24c
JVM_NativeLoad 0x00007be11f7a2f3a
getSystemTimeZoneID 0x0000000071df9d21
art_quick_invoke_static_stub 0x00007be124d1ce17
art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*) 0x00007be124828604
art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*) 0x00007be1249fab92
bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x00007be1249f3c6e
bool art::interpreter::DoInvoke<(art::InvokeType)0, false, false>(art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x00007be124a331a3
void art::interpreter::ExecuteSwitchImplCpp<false, false>(art::interpreter::SwitchImplContext*) 0x00007be124a1ccef
ExecuteSwitchImplAsm 0x00007be124d28f26
art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool) (.llvm.2620325170) 0x00007be1249cae8e
art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*) 0x00007be1249d0a4f
bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x00007be1249f3c55
bool art::interpreter::DoInvoke<(art::InvokeType)2, false, false>(art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x00007be124a303ef
void art::interpreter::ExecuteSwitchImplCpp<false, false>(art::interpreter::SwitchImplContext*) 0x00007be124a1d00f
ExecuteSwitchImplAsm 0x00007be124d28f26
art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool) (.llvm.2620325170) 0x00007be1249cae8e
art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*) 0x00007be1249d0a4f
bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x00007be1249f3c55
bool art::interpreter::DoInvoke<(art::InvokeType)0, false, false>(art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x00007be124a331a3
void art::interpreter::ExecuteSwitchImplCpp<false, false>(art::interpreter::SwitchImplContext*) 0x00007be124a1ccef
ExecuteSwitchImplAsm 0x00007be124d28f26
art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool) (.llvm.2620325170) 0x00007be1249cae8e
artQuickToInterpreterBridge 0x00007be124cd7548
art_quick_to_interpreter_bridge 0x00007be124d271ed
art_quick_invoke_static_stub 0x00007be124d1ce17
art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*) 0x00007be124828604
art::ClassLinker::InitializeClass(art::Thread*, art::Handle<art::mirror::Class>, bool, bool) 0x00007be1248837d7
art::ClassLinker::EnsureInitialized(art::Thread*, art::Handle<art::mirror::Class>, bool, bool) 0x00007be12486cb30
art::Class_newInstance(_JNIEnv*, _jobject*) 0x00007be124b75aae
getExceptionTypes 0x0000000071df927e
art_quick_invoke_stub 0x00007be124d1cab5
art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*) 0x00007be1248285f3
art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*) 0x00007be1249fab92
bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x00007be1249f3c6e
bool art::interpreter::DoInvoke<(art::InvokeType)2, false, false>(art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x00007be124a303ef
void art::interpreter::ExecuteSwitchImplCpp<false, false>(art::interpreter::SwitchImplContext*) 0x00007be124a1d00f
ExecuteSwitchImplAsm 0x00007be124d28f26
art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool) (.llvm.2620325170) 0x00007be1249cae8e
art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*) 0x00007be1249d0a4f
bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x00007be1249f3c55
bool art::interpreter::DoInvoke<(art::InvokeType)3, false, false>(art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x00007be124a30e4e
void art::interpreter::ExecuteSwitchImplCpp<false, false>(art::interpreter::SwitchImplContext*) 0x00007be124a1c43e
ExecuteSwitchImplAsm 0x00007be124d28f26
art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool) (.llvm.2620325170) 0x00007be1249cae8e
art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*) 0x00007be1249d0a4f
bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x00007be1249f3c55
bool art::interpreter::DoInvoke<(art::InvokeType)2, false, false>(art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x00007be124a303ef
void art::interpreter::ExecuteSwitchImplCpp<false, false>(art::interpreter::SwitchImplContext*) 0x00007be124a1d00f
ExecuteSwitchImplAsm 0x00007be124d28f26
art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool) (.llvm.2620325170) 0x00007be1249cae8e
art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*) 0x00007be1249d0a4f
bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x00007be1249f3c55
bool art::interpreter::DoInvoke<(art::InvokeType)2, false, false>(art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x00007be124a303ef
void art::interpreter::ExecuteSwitchImplCpp<false, false>(art::interpreter::SwitchImplContext*) 0x00007be124a1d00f
ExecuteSwitchImplAsm 0x00007be124d28f26
art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool) (.llvm.2620325170) 0x00007be1249cae8e
art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*) 0x00007be1249d0a4f
bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x00007be1249f3c55
bool art::interpreter::DoInvoke<(art::InvokeType)1, false, false>(art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x00007be124a31c41
void art::interpreter::ExecuteSwitchImplCpp<false, false>(art::interpreter::SwitchImplContext*) 0x00007be124a1d745
ExecuteSwitchImplAsm 0x00007be124d28f26
art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool) (.llvm.2620325170) 0x00007be1249cae8e
art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*) 0x00007be1249d0a4f
bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x00007be1249f3c55
bool art::interpreter::DoInvoke<(art::InvokeType)2, false, false>(art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x00007be124a303ef
void art::interpreter::ExecuteSwitchImplCpp<false, false>(art::interpreter::SwitchImplContext*) 0x00007be124a1d00f
ExecuteSwitchImplAsm 0x00007be124d28f26
art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool) (.llvm.2620325170) 0x00007be1249cae8e
art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*) 0x00007be1249d0a4f
bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x00007be1249f3c55
bool art::interpreter::DoInvoke<(art::InvokeType)2, false, false>(art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x00007be124a303ef
void art::interpreter::ExecuteSwitchImplCpp<false, false>(art::interpreter::SwitchImplContext*) 0x00007be124a1d00f
ExecuteSwitchImplAsm 0x00007be124d28f26
art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool) (.llvm.2620325170) 0x00007be1249cae8e
art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*) 0x00007be1249d0a4f
bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x00007be1249f3c55
bool art::interpreter::DoInvoke<(art::InvokeType)2, false, false>(art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x00007be124a303ef
void art::interpreter::ExecuteSwitchImplCpp<false, false>(art::interpreter::SwitchImplContext*) 0x00007be124a1d00f
ExecuteSwitchImplAsm 0x00007be124d28f26
art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool) (.llvm.2620325170) 0x00007be1249cae8e
art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool) (.llvm.2620325170) 0x00007be1249cae8e
art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*) 0x00007be1249d0a4f
bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x00007be1249f3c55
bool art::interpreter::DoInvoke<(art::InvokeType)2, false, false>(art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x00007be124a303ef
void art::interpreter::ExecuteSwitchImplCpp<false, false>(art::interpreter::SwitchImplContext*) 0x00007be124a1d00f
ExecuteSwitchImplAsm 0x00007be124d28f26
art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool) (.llvm.2620325170) 0x00007be1249cae8e
art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*) 0x00007be1249d0a4f
bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x00007be1249f3c55
bool art::interpreter::DoInvoke<(art::InvokeType)2, false, false>(art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x00007be124a303ef
void art::interpreter::ExecuteSwitchImplCpp<false, false>(art::interpreter::SwitchImplContext*) 0x00007be124a1d00f
ExecuteSwitchImplAsm 0x00007be124d28f26
art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool) (.llvm.2620325170) 0x00007be1249cae8e
art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*) 0x00007be1249d0a4f
bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x00007be1249f3c55
MterpInvokeStatic 0x00007be124cea16e
ExecuteMterpImpl 0x00007be124d0e11a
art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool) (.llvm.2620325170) 0x00007be1249caee2
artQuickToInterpreterBridge 0x00007be124cd7548
art_quick_to_interpreter_bridge 0x00007be124d271ed
<unknown> 0x00007be124d274e0