Building RPC APK: clang++: error: linker command failed with exit code 1

[Host: Ubuntu 18.04 - x86-64 / Device: Snapdragon 865 - Arm64]

I’m using docker image and having trouble building TVM RPC APK. I followed the guide from https://github.com/apache/incubator-tvm/blob/main/apps/android_rpc/README.md.

What I proceeded from the initial docker image is,

  1. build tvm4j
  • make jvmpkg
  • jvm install
  1. modify config.mk and Android.mk after searching most of discussion
  • add opencl headers and libOpenCL.so pulled from my Android device
  1. make standalone toolchain
  • I followed the same as example below since I think I have the corresponding environment:

$ANDROID_NDK_HOME/build/tools/make-standalone-toolchain.sh
–platform=android-24 --use-llvm --arch=arm64 --install-dir=/opt/android-toolchain-arm64 export TVM_NDK_CC=/opt/android-toolchain-arm64/bin/aarch64-linux-android-g++

and if I execute ./build.sh from jni directory, I get:

root@tvm:/workspace/apps/android_rpc/app/src/main/jni# ./build.sh make: Entering directory ‘/workspace/apps/android_rpc/app/src/main/jni’ Android NDK: WARNING: APP_PLATFORM android-24 is higher than android:minSdkVersion 1 in /workspace/apps/android_rpc/app/src/main/AndroidManifest.xml. NDK binaries will not be compatible with devices older than android-24. See https://android.googlesource.com/platform/ndk/+/master/docs/user/common_problems.md for more information.
Android NDK: WARNING:/workspace/apps/android_rpc/app/src/main/jni/Android.mk:tvm4j_runtime_packed: non-system libraries in linker flags: -latomic /workspace/apps/android_rpc/app/src/main/jni/libOpenCL.so
Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES
Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the
Android NDK: current module
make: Leaving directory ‘/workspace/apps/android_rpc/app/src/main/jni’ make: Entering directory ‘/workspace/apps/android_rpc/app/src/main/jni’ [arm64-v8a] Compile++ : tvm4j_runtime_packed <= org_apache_tvm_native_c_api.cc In file included from /workspace/apps/android_rpc/app/src/main/jni/org_apache_tvm_native_c_api.cc:25: In file included from /workspace/apps/android_rpc/app/src/main/jni/tvm_runtime.h:65: In file included from /workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/opencl/opencl_device_api.cc:26: In file included from /workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/opencl/opencl_common.h:45: In file included from /usr/local/OpenCL-Headers/CL/opencl.h:24: In file included from /usr/local/OpenCL-Headers/CL/cl.h:20: /usr/local/OpenCL-Headers/CL/cl_version.h:22:9: warning: cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2) [-W#pragma-messages] #pragma message(“cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)”) ^ 1 warning generated. [arm64-v8a] SharedLibrary : libtvm4j_runtime_packed.so /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed//workspace/apps/android_rpc/app/src/main/jni///////src/runtime/rpc/rpc_channel.o: In function tvm::runtime::CallbackChannel::Recv(void*, unsigned long)': /workspace/apps/android_rpc/app/src/main/jni/../../../../../../src/runtime/rpc/rpc_channel.cc:41: multiple definition of tvm::runtime::CallbackChannel::Recv(void*, unsigned long)’ /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed/org_apache_tvm_native_c_api.o:/workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/rpc/rpc_channel.cc:41: first defined here /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed//workspace/apps/android_rpc/app/src/main/jni///////src/runtime/rpc/rpc_channel.o: In function std::__ndk1::ios_base::rdbuf() const': /opt/android-sdk-linux/ndk/21.3.6528147/sources/cxx-stl/llvm-libc++/include/ostream:456: multiple definition of tvm::runtime::CallbackChannel::Send(void const*, unsigned long)’ /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed/org_apache_tvm_native_c_api.o:/workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/c_runtime_api.cc:45: first defined here /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed//workspace/apps/android_rpc/app/src/main/jni///////src/runtime/rpc/rpc_channel.o: In function std::__ndk1::ios_base::rdbuf() const': /opt/android-sdk-linux/ndk/21.3.6528147/sources/cxx-stl/llvm-libc++/include/ostream:456: multiple definition of typeinfo for tvm::runtime::CallbackChannel’ /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed/org_apache_tvm_native_c_api.o:/workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/c_runtime_api.cc:45: first defined here /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed//workspace/apps/android_rpc/app/src/main/jni///////src/runtime/rpc/rpc_channel.o: In function std::__ndk1::ios_base::rdbuf() const': /opt/android-sdk-linux/ndk/21.3.6528147/sources/cxx-stl/llvm-libc++/include/ostream:456: multiple definition of typeinfo name for tvm::runtime::CallbackChannel’ /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed/org_apache_tvm_native_c_api.o:/workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/c_runtime_api.cc:45: first defined here /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed//workspace/apps/android_rpc/app/src/main/jni///////src/runtime/rpc/rpc_channel.o: In function std::__ndk1::ios_base::rdbuf() const': /opt/android-sdk-linux/ndk/21.3.6528147/sources/cxx-stl/llvm-libc++/include/ostream:456: multiple definition of vtable for tvm::runtime::CallbackChannel’ /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed/org_apache_tvm_native_c_api.o:/workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/c_runtime_api.cc:45: first defined here /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed//workspace/apps/android_rpc/app/src/main/jni///////src/runtime/rpc/rpc_endpoint.o: In function tvm::runtime::RPCEndpoint::ServerLoop()': /workspace/apps/android_rpc/app/src/main/jni/../../../../../../src/runtime/rpc/rpc_endpoint.cc:737: multiple definition of tvm::runtime::RPCEndpoint::ServerLoop()’ /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed/org_apache_tvm_native_c_api.o:/workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/c_runtime_api.cc:45: first defined here /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed//workspace/apps/android_rpc/app/src/main/jni///////src/runtime/rpc/rpc_endpoint.o: In function std::__ndk1::_DeallocateCaller::__do_call(void*)': /workspace/apps/android_rpc/app/src/main/jni/../../../../../../src/runtime/rpc/rpc_endpoint.cc:510: multiple definition of tvm::runtime::RPCEndpoint::CopyToRemote(void*, unsigned long, void*, unsigned long, unsigned long, DLContext, DLDataType)’ /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed/org_apache_tvm_native_c_api.o:/workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/c_runtime_api.cc:45: first defined here /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed//workspace/apps/android_rpc/app/src/main/jni///////src/runtime/rpc/rpc_endpoint.o: In function std::__ndk1::_DeallocateCaller::__do_call(void*)': /workspace/apps/android_rpc/app/src/main/jni/../../../../../../src/runtime/rpc/rpc_endpoint.cc:510: multiple definition of tvm::runtime::RPCEndpoint::EventHandler::HandleSyscall(tvm::runtime::RPCCode)’ /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed/org_apache_tvm_native_c_api.o:/workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/c_runtime_api.cc:45: first defined here /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed//workspace/apps/android_rpc/app/src/main/jni///////src/runtime/rpc/rpc_endpoint.o: In function std::__ndk1::_DeallocateCaller::__do_call(void*)': /workspace/apps/android_rpc/app/src/main/jni/../../../../../../src/runtime/rpc/rpc_endpoint.cc:510: multiple definition of tvm::runtime::RPCEndpoint::CopyFromRemote(void*, unsigned long, void*, unsigned long, unsigned long, DLContext, DLDataType)’ /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed/org_apache_tvm_native_c_api.o:/workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/c_runtime_api.cc:45: first defined here /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed//workspace/apps/android_rpc/app/src/main/jni///////src/runtime/rpc/rpc_endpoint.o: In function std::__ndk1::_DeallocateCaller::__do_call(void*)': /workspace/apps/android_rpc/app/src/main/jni/../../../../../../src/runtime/rpc/rpc_endpoint.cc:510: multiple definition of tvm::runtime::RPCEndpoint::InitRemoteSession(tvm::runtime::TVMArgs)’ /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed/org_apache_tvm_native_c_api.o:/workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/c_runtime_api.cc:45: first defined here /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed//workspace/apps/android_rpc/app/src/main/jni///////src/runtime/rpc/rpc_endpoint.o: In function std::__ndk1::_DeallocateCaller::__do_call(void*)': /workspace/apps/android_rpc/app/src/main/jni/../../../../../../src/runtime/rpc/rpc_endpoint.cc:510: multiple definition of tvm::runtime::RPCEndpoint::HandleUntilReturnEvent(bool, std::ndk1::function<void (tvm::runtime::TVMArgs)>)’ /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed/org_apache_tvm_native_c_api.o:/workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/c_runtime_api.cc:45: first defined here /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed//workspace/apps/android_rpc/app/src/main/jni///////src/runtime/rpc/rpc_endpoint.o: In function std::__ndk1::_DeallocateCaller::__do_call(void*)': /workspace/apps/android_rpc/app/src/main/jni/../../../../../../src/runtime/rpc/rpc_endpoint.cc:510: multiple definition of tvm::runtime::RPCEndpoint::ServerAsyncIOEventHandler(std::ndk1::basic_string<char, std::ndk1::char_traits, std::ndk1::allocator > const&, int)’ /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed/org_apache_tvm_native_c_api.o:/workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/c_runtime_api.cc:45: first defined here /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed//workspace/apps/android_rpc/app/src/main/jni///////src/runtime/rpc/rpc_endpoint.o: In function std::__ndk1::_DeallocateCaller::__do_call(void*)': /workspace/apps/android_rpc/app/src/main/jni/../../../../../../src/runtime/rpc/rpc_endpoint.cc:510: multiple definition of tvm::runtime::RPCEndpoint::Init()’ /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed/org_apache_tvm_native_c_api.o:/workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/c_runtime_api.cc:45: first defined here /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed//workspace/apps/android_rpc/app/src/main/jni///////src/runtime/rpc/rpc_endpoint.o: In function std::__ndk1::_DeallocateCaller::__do_call(void*)': /workspace/apps/android_rpc/app/src/main/jni/../../../../../../src/runtime/rpc/rpc_endpoint.cc:510: multiple definition of tvm::runtime::RPCEndpoint::Create(std::ndk1::unique_ptr<tvm::runtime::RPCChannel, std::ndk1::default_deletetvm::runtime::RPCChannel >, std::ndk1::basic_string<char, std::ndk1::char_traits, std::ndk1::allocator >, std::ndk1::basic_string<char, std::ndk1::char_traits, std::ndk1::allocator >)’ /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed/org_apache_tvm_native_c_api.o:/workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/c_runtime_api.cc:45: first defined here /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed//workspace/apps/android_rpc/app/src/main/jni///////src/runtime/rpc/rpc_endpoint.o: In function std::__ndk1::_DeallocateCaller::__do_call(void*)': /workspace/apps/android_rpc/app/src/main/jni/../../../../../../src/runtime/rpc/rpc_endpoint.cc:510: multiple definition of tvm::runtime::RPCEndpoint::CallFunc(void*, TVMValue const*, int const*, int, std::ndk1::function<void (tvm::runtime::TVMArgs)>)’ /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed/org_apache_tvm_native_c_api.o:/workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/c_runtime_api.cc:45: first defined here /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed//workspace/apps/android_rpc/app/src/main/jni///////src/runtime/rpc/rpc_endpoint.o: In function std::__ndk1::_DeallocateCaller::__do_call(void*)': /workspace/apps/android_rpc/app/src/main/jni/../../../../../../src/runtime/rpc/rpc_endpoint.cc:510: multiple definition of tvm::runtime::RPCEndpoint::Shutdown()’ /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed/org_apache_tvm_native_c_api.o:/workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/c_runtime_api.cc:45: first defined here /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed//workspace/apps/android_rpc/app/src/main/jni///////src/runtime/rpc/rpc_endpoint.o: In function std::__ndk1::_DeallocateCaller::__do_call(void*)': /workspace/apps/android_rpc/app/src/main/jni/../../../../../../src/runtime/rpc/rpc_endpoint.cc:510: multiple definition of tvm::runtime::RPCEndpoint::~RPCEndpoint()’ /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed/org_apache_tvm_native_c_api.o:/workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/c_runtime_api.cc:45: first defined here /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed//workspace/apps/android_rpc/app/src/main/jni///////src/runtime/rpc/rpc_endpoint.o: In function std::__ndk1::_DeallocateCaller::__do_call(void*)': /workspace/apps/android_rpc/app/src/main/jni/../../../../../../src/runtime/rpc/rpc_endpoint.cc:510: multiple definition of tvm::runtime::RPCEndpoint::~RPCEndpoint()’ /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed/org_apache_tvm_native_c_api.o:/workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/c_runtime_api.cc:45: first defined here /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed//workspace/apps/android_rpc/app/src/main/jni///////src/runtime/rpc/rpc_endpoint.o: In function std::__ndk1::_DeallocateCaller::__do_call(void*)': /workspace/apps/android_rpc/app/src/main/jni/../../../../../../src/runtime/rpc/rpc_endpoint.cc:510: multiple definition of tvm::runtime::RPCDevGetAttr(tvm::runtime::RPCSession*, tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)’ /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed/org_apache_tvm_native_c_api.o:/workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/c_runtime_api.cc:45: first defined here /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed//workspace/apps/android_rpc/app/src/main/jni///////src/runtime/rpc/rpc_endpoint.o: In function std::__ndk1::_DeallocateCaller::__do_call(void*)': /workspace/apps/android_rpc/app/src/main/jni/../../../../../../src/runtime/rpc/rpc_endpoint.cc:510: multiple definition of tvm::runtime::RPCFreeHandle(tvm::runtime::RPCSession*, tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)’ /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed/org_apache_tvm_native_c_api.o:/workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/c_runtime_api.cc:45: first defined here /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed//workspace/apps/android_rpc/app/src/main/jni///////src/runtime/rpc/rpc_endpoint.o: In function std::__ndk1::_DeallocateCaller::__do_call(void*)': /workspace/apps/android_rpc/app/src/main/jni/../../../../../../src/runtime/rpc/rpc_endpoint.cc:510: multiple definition of tvm::runtime::RPCDevFreeData(tvm::runtime::RPCSession*, tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)’ /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed/org_apache_tvm_native_c_api.o:/workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/c_runtime_api.cc:45: first defined here /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed//workspace/apps/android_rpc/app/src/main/jni///////src/runtime/rpc/rpc_endpoint.o: In function std::__ndk1::_DeallocateCaller::__do_call(void*)': /workspace/apps/android_rpc/app/src/main/jni/../../../../../../src/runtime/rpc/rpc_endpoint.cc:510: multiple definition of tvm::runtime::RPCDevAllocData(tvm::runtime::RPCSession*, tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)’ /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed/org_apache_tvm_native_c_api.o:/workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/c_runtime_api.cc:45: first defined here /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed//workspace/apps/android_rpc/app/src/main/jni///////src/runtime/rpc/rpc_endpoint.o: In function std::__ndk1::_DeallocateCaller::__do_call(void*)': /workspace/apps/android_rpc/app/src/main/jni/../../../../../../src/runtime/rpc/rpc_endpoint.cc:510: multiple definition of tvm::runtime::RPCDevSetDevice(tvm::runtime::RPCSession*, tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)’ /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed/org_apache_tvm_native_c_api.o:/workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/c_runtime_api.cc:45: first defined here /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed//workspace/apps/android_rpc/app/src/main/jni///////src/runtime/rpc/rpc_endpoint.o: In function std::__ndk1::_DeallocateCaller::__do_call(void*)': /workspace/apps/android_rpc/app/src/main/jni/../../../../../../src/runtime/rpc/rpc_endpoint.cc:510: multiple definition of tvm::runtime::RPCGetGlobalFunc(tvm::runtime::RPCSession*, tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)’ /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed/org_apache_tvm_native_c_api.o:/workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/c_runtime_api.cc:45: first defined here /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed//workspace/apps/android_rpc/app/src/main/jni///////src/runtime/rpc/rpc_endpoint.o: In function std::__ndk1::_DeallocateCaller::__do_call(void*)': /workspace/apps/android_rpc/app/src/main/jni/../../../../../../src/runtime/rpc/rpc_endpoint.cc:510: multiple definition of tvm::runtime::RPCCopyAmongRemote(tvm::runtime::RPCSession*, tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)’ /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed/org_apache_tvm_native_c_api.o:/workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/c_runtime_api.cc:45: first defined here /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed//workspace/apps/android_rpc/app/src/main/jni///////src/runtime/rpc/rpc_endpoint.o: In function std::__ndk1::_DeallocateCaller::__do_call(void*)': /workspace/apps/android_rpc/app/src/main/jni/../../../../../../src/runtime/rpc/rpc_endpoint.cc:510: multiple definition of tvm::runtime::CreateClientSession(std::ndk1::shared_ptrtvm::runtime::RPCEndpoint)’ /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed/org_apache_tvm_native_c_api.o:/workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/c_runtime_api.cc:45: first defined here /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed//workspace/apps/android_rpc/app/src/main/jni///////src/runtime/rpc/rpc_local_session.o: In function tvm::runtime::LocalSession::FreeHandle(void*, int)': /workspace/apps/android_rpc/app/src/main/jni/../../../../../../src/runtime/rpc/rpc_local_session.cc:115: multiple definition of tvm::runtime::LocalSession::FreeHandle(void*, int)’ /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed/org_apache_tvm_native_c_api.o:/workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/c_runtime_api.cc:45: first defined here /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed//workspace/apps/android_rpc/app/src/main/jni///////src/runtime/rpc/rpc_local_session.o: In function std::__ndk1::_DeallocateCaller::__do_call(void*)': /opt/android-sdk-linux/ndk/21.3.6528147/sources/cxx-stl/llvm-libc++/include/ostream:456: multiple definition of tvm::runtime::LocalSession::GetFunction(std::ndk1::basic_string<char, std::ndk1::char_traits, std::ndk1::allocator > const&)’ /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed/org_apache_tvm_native_c_api.o:/workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/c_runtime_api.cc:45: first defined here /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed//workspace/apps/android_rpc/app/src/main/jni///////src/runtime/rpc/rpc_local_session.o: In function std::__ndk1::_DeallocateCaller::__do_call(void*)': /opt/android-sdk-linux/ndk/21.3.6528147/sources/cxx-stl/llvm-libc++/include/ostream:456: multiple definition of tvm::runtime::LocalSession::CopyToRemote(void*, unsigned long, void*, unsigned long, unsigned long, DLContext, DLDataType)’ /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed/org_apache_tvm_native_c_api.o:/workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/c_runtime_api.cc:45: first defined here /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed//workspace/apps/android_rpc/app/src/main/jni///////src/runtime/rpc/rpc_local_session.o: In function std::__ndk1::_DeallocateCaller::__do_call(void*)': /opt/android-sdk-linux/ndk/21.3.6528147/sources/cxx-stl/llvm-libc++/include/ostream:456: multiple definition of tvm::runtime::LocalSession::EncodeReturn(tvm::runtime::TVMRetValue, std::ndk1::function<void (tvm::runtime::TVMArgs)> const&)’ /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed/org_apache_tvm_native_c_api.o:/workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/c_runtime_api.cc:45: first defined here /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed//workspace/apps/android_rpc/app/src/main/jni///////src/runtime/rpc/rpc_local_session.o: In function std::__ndk1::_DeallocateCaller::__do_call(void*)': /opt/android-sdk-linux/ndk/21.3.6528147/sources/cxx-stl/llvm-libc++/include/ostream:456: multiple definition of tvm::runtime::LocalSession::GetDeviceAPI(DLContext, bool)’ /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed/org_apache_tvm_native_c_api.o:/workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/c_runtime_api.cc:45: first defined here /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed//workspace/apps/android_rpc/app/src/main/jni///////src/runtime/rpc/rpc_local_session.o: In function std::__ndk1::_DeallocateCaller::__do_call(void*)': /opt/android-sdk-linux/ndk/21.3.6528147/sources/cxx-stl/llvm-libc++/include/ostream:456: multiple definition of tvm::runtime::LocalSession::CopyFromRemote(void*, unsigned long, void*, unsigned long, unsigned long, DLContext, DLDataType)’ /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed/org_apache_tvm_native_c_api.o:/workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/c_runtime_api.cc:45: first defined here /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed//workspace/apps/android_rpc/app/src/main/jni///////src/runtime/rpc/rpc_local_session.o: In function std::__ndk1::_DeallocateCaller::__do_call(void*)': /opt/android-sdk-linux/ndk/21.3.6528147/sources/cxx-stl/llvm-libc++/include/ostream:456: multiple definition of tvm::runtime::LocalSession::CallFunc(void*, TVMValue const*, int const*, int, std::ndk1::function<void (tvm::runtime::TVMArgs)> const&)’ /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed/org_apache_tvm_native_c_api.o:/workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/c_runtime_api.cc:45: first defined here /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed//workspace/apps/android_rpc/app/src/main/jni///////src/runtime/rpc/rpc_local_session.o: In function std::__ndk1::_DeallocateCaller::__do_call(void*)': /opt/android-sdk-linux/ndk/21.3.6528147/sources/cxx-stl/llvm-libc++/include/ostream:456: multiple definition of typeinfo for tvm::runtime::LocalSession’ /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed/org_apache_tvm_native_c_api.o:/workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/c_runtime_api.cc:45: first defined here /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed//workspace/apps/android_rpc/app/src/main/jni///////src/runtime/rpc/rpc_local_session.o: In function std::__ndk1::_DeallocateCaller::__do_call(void*)': /opt/android-sdk-linux/ndk/21.3.6528147/sources/cxx-stl/llvm-libc++/include/ostream:456: multiple definition of typeinfo name for tvm::runtime::LocalSession’ /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed/org_apache_tvm_native_c_api.o:/workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/c_runtime_api.cc:45: first defined here /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed//workspace/apps/android_rpc/app/src/main/jni//////__/src/runtime/rpc/rpc_local_session.o: In function std::__ndk1::_DeallocateCaller::__do_call(void*)': /opt/android-sdk-linux/ndk/21.3.6528147/sources/cxx-stl/llvm-libc++/include/ostream:456: multiple definition of vtable for tvm::runtime::LocalSession’ /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/objs/tvm4j_runtime_packed/org_apache_tvm_native_c_api.o:/workspace/apps/android_rpc/app/src/main/jni/…/…/…/…/…/…/include/…/src/runtime/c_runtime_api.cc:45: first defined here
\

**clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/opt/android-sdk-linux/ndk/21.3.6528147/build/core/build-binary.mk:725: /workspace/apps/android_rpc/app/src/main/obj/local/arm64-v8a/libtvm4j_runtime_packed.so] Error 1
make: Leaving directory '/workspace/apps/android_rpc/app/src/main/jni'**


I think there is linker mismatch issue during cross-compilation. Did anyone have this kind of issue?