[Hexagon] sim_dev undefined symbol

I compiled tvm/sim_dev with “USE_HEXAGON_DEVICE=sim”, then I compiled libtvm_runtime.so with

CC=$DEFAULT_HEXAGON_TOOLS_ROOT/Tools/bin/hexagon-clang CXX=$DEFAULT_HEXAGON_TOOLS_ROOT/Tools/bin/hexagon-clang++ CXXFLAGS='-stdlib=libc++' cmake .. -DUSE_RPC=OFF -DUSE_LLVM=OFF -DUSE_HEXAGON_DEVICE=OFF -DUSE_HEXAGON_ARCH=v66 -DUSE_HEXAGON_SDK=$HEXAGON_SDK_ROOT -DUSE_LIBBACKTRACE=OFF

but sim_dev always report undefined symbol:

tvm/include/../src/runtime/hexagon/sim/hexagon_device_sim.cc:634: HexagonSimulator: Core version: v66 tvm/src/runtime/hexagon/sim/driver/sim_device.cc:520: TVM runtime path: /opt/qca/Hexagon_SDK/3.5.4/tools/HEXAGON_Tools/8.3.07/Tools/target/hexagon/lib/v66/G0/pic/libtvm_runtime.so tvm/src/runtime/hexagon/sim/driver/sim_device.cc:532: error loading TVM runtime: undefined symbol (0) /opt/qca/Hexagon_SDK/3.5.4/tools/HEXAGON_Tools/8.3.07/Tools/target/hexagon/lib/v66/G0/pic/libtvm_runtime terminate called after throwing an instance of 'tvm::runtime::InternalError' what(): tvm/include/../src/runtime/hexagon/sim/hexagon_device_sim.cc:669: HexagonSimulator: Run not stopped on breakpoint, code=1

is the library wrong:

ADSP_LIBRARY_PATH=/opt/qca/Hexagon_SDK/3.5.4/tools/HEXAGON_Tools/8.3.07/Tools/target/hexagon/lib/v66/G0/pic/

or sdk version not supported?

Does your CMakeLists.txt contain a line

add_definitions(-DDMLC_CXX11_THREAD_LOCAL=0)

inside of the “if build for Hexagon” statement? If not, could you try adding it (it should be present in recent TVM sources)?

Yes, CMakeLists.txt contain the line, I am using latest main branch(commit 0564d38).

Although it’s been a while, just paste the solution here for anyone who might need it: TVM runtime for Hexagon breaks in main branch