[Solved] Import tvm error: libtvm.so: undefined symbol: _ZTIN3tvm4NodeE


#1
  • install from source
  • config cmake: only set(USE_LLVM ON )
  • llvm 8.0 enabled
  • gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.11)
  • x86_64-linux-gnu

Error log

Python 3.5.2 (default, Nov 12 2018, 13:43:14) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tvm
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/yuanshuai06/Baidu/code/tvm/python/tvm/__init__.py", line 23, in <module>
    from . import tensor
  File "/Users/yuanshuai06/Baidu/code/tvm/python/tvm/tensor.py", line 20, in <module>
    from ._ffi.node import NodeBase, NodeGeneric, register_node, convert_to_node
  File "/Users/yuanshuai06/Baidu/code/tvm/python/tvm/_ffi/node.py", line 24, in <module>
    from .node_generic import NodeGeneric, convert_to_node, const
  File "/Users/yuanshuai06/Baidu/code/tvm/python/tvm/_ffi/node_generic.py", line 23, in <module>
    from .base import string_types
  File "/Users/yuanshuai06/Baidu/code/tvm/python/tvm/_ffi/base.py", line 60, in <module>
    _LIB, _LIB_NAME = _load_lib()
  File "/Users/yuanshuai06/Baidu/code/tvm/python/tvm/_ffi/base.py", line 52, in _load_lib
    lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_GLOBAL)
  File "/usr/lib/python3.5/ctypes/__init__.py", line 347, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /Users/yuanshuai06/Baidu/code/tvm/build/libtvm.so: undefined symbol: _ZTIN3tvm4NodeE
>>> 

Python installation

According to doc, export codes below to ~/.bashrc

export TVM_HOME=/Users/yuanshuai06/Baidu/code/tvm/
export PYTHONPATH=$TVM_HOME/python:$TVM_HOME/topi/python:$TVM_HOME/nnvm/python:${PYTHONPATH}

Any idea? Thanks in advance.


Import topi error: libtvm_topi.so: undefined symbol: _ZTIN3tvm4NodeE
#2

Could you go to your build directory and do

nm libtvm.so | grep N3tvm4NodeE

and

nm CMakeFiles/tvm.dir/3rdparty/HalideIR/src/tvm/node/node.cpp.o | grep N3tvm4NodeE


#3

Have you solved the problem? I see your another issue on Github: https://github.com/dmlc/tvm/issues/448


#4

Thanks guys. I fixed.

Fixed.

This problem is due to LLVM version. My OS is Ubuntu 16.04 64bit, but I downloaded an LLVM 4.0.1 for debian8 OS (LLVM 4.0.1 for debian8 doesn’t support Ubuntu 16.04) previously. After replacing clang+llvm-4.0.1-x86_64-linux-gnu-debian8.tar.xz with clang+llvm-4.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz and other installation operations, it’s fixed.