Check failed: override: Global PackedFunc __tvm_set_device is already registered" failed

I’m using tvm on android 7.1.2 (armv7).
It builds successfully with the latest tvm source code for libtvm_runtime.so libtvm.so.
But when running with the executable binary, the binary aborted abnormally, which says:

--------- beginning of crash
2019-06-25 19:54:56.505 13683-13683/com.xxxx A/libc: /usr/local/google/buildbot/src/android/ndk-r15-release/external/libcxx/…/…/external/libcxxabi/src/abort_message.cpp:74: void abort_message(const char *, …): assertion “terminating with uncaught exception of type dmlc::Error: [19:54:56] /workspace/src/runtime/registry.cc:79: Check failed: override: Global PackedFunc __tvm_set_device is already registered” failed
2019-06-25 19:54:56.505 13683-13683/com.xxxx A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 13683 (com.xxxx)
2019-06-25 19:54:56.569 13703-13703/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2019-06-25 19:54:56.569 13703-13703/? A/DEBUG: Build fingerprint: ‘Android/rk3288/rk3288:7.1.2/NHG47K/eric03211536:userdebug/test-keys’
2019-06-25 19:54:56.569 13703-13703/? A/DEBUG: Revision: ‘0’
2019-06-25 19:54:56.569 13703-13703/? A/DEBUG: ABI: ‘arm’
2019-06-25 19:54:56.569 13703-13703/? A/DEBUG: pid: 13683, tid: 13683, name: com.xxxx >>> com.xxxx <<<
2019-06-25 19:54:56.569 13703-13703/? A/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
2019-06-25 19:54:56.573 13703-13703/? A/DEBUG: Abort message: ‘/usr/local/google/buildbot/src/android/ndk-r15-release/external/libcxx/…/…/external/libcxxabi/src/abort_message.cpp:74: void abort_message(const char *, …): assertion “terminating with uncaught exception of type dmlc::Error: [19:54:56] /workspace/src/runtime/registry.cc:79: Check failed: override: Global PackedFunc __tvm_set_device is already registered” failed’
2019-06-25 19:54:56.574 13703-13703/? A/DEBUG: r0 00000000 r1 00003573 r2 00000006 r3 00000008
2019-06-25 19:54:56.574 13703-13703/? A/DEBUG: r4 ab0f658c r5 00000006 r6 ab0f6534 r7 0000010c
2019-06-25 19:54:56.574 13703-13703/? A/DEBUG: r8 8efc0c19 r9 ab0f35f0 sl ab0e3a7b fp bea28950
2019-06-25 19:54:56.574 13703-13703/? A/DEBUG: ip 00000058 sp bea28440 lr aaa15857 pc aaa180c0 cpsr 60030010

I’ve no idea why this kind of error occurs, is there anything wrong when using the tvm shared libraries?

have you solved this problem? I have the same issue over here

I’m trying to deploy my model on MacBook pro but meet the same problem as you met. I just find that when I load two dynamic libs together in this way, the error will occur:

target_link_libraries(infertest PRIVATE tvm_runtime tvm ${OpenCV_LIBS}) Therefore i removed tvm in this line and problem seems solved.

You only need to load one of the libraries, as libtvm already contains the runtime component