[issue] undefined symbol when import tvm

hi, I build tvm with llvm 6.0 or 7.0 targeting intel CPU and succeed, my os is centos, but when I type import tvm, error is below:

Python 3.7.13 
[GCC 7.5.0] :: Anaconda, Inc. 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 "/home/zxxx/tvm/python/tvm/__init__.py", line 26, in <module>
from ._ffi.base import TVMError, __version__, _RUNTIME_ONLY
File "/home/xxx/tvm/python/tvm/_ffi/__init__.py", line 28, in <module>
    from .base import register_error
File "/home/xxx/tvm/python/tvm/_ffi/base.py", line 71, in <module>
   _LIB, _LIB_NAME = _load_lib()
File "/home/xxx/tvm/python/tvm/_ffi/base.py", line 57, in _load_lib
    lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_GLOBAL)
File "/home/xxx/miniconda3/envs/xxx/lib/python3.7/ctypes/__init__.py", line 364, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /home/xxx/tvm/build/libtvm.so: undefined symbol: _ZNKSt3__114error_category10equivalentERKNS_10error_codeEi

BTW, when I build tvm without llvm, the import is well. Did i use wrong llvm pre-built binary?I used * SuSE Linux Enterprise Server 11SP3 x86_64 (.sig)

Anybody can help me? Thanks for your time!

Try with a more recent llvm and see if that works .


1 Like

Thanks reply, I tried llvm10 pre-compiled binary whose postfix is “x86_64-linux-sles11.3.tar.xz” , and when I typed “import tvm”, still OSerror: "OSError: /home/xxxxx/tvm/build/libtvm.so: undefined symbol: _ZNKSt3__119__shared_weak_count13__get_deleterERKSt9type_info"

I also tried llvm14 12 11 pre-compiled binary whose postfix are all “x86_64-linux-sles12.4.tar.xz” but when I typed “clang -v”, it crashed, and reported “can’t load open shared library: libatomic.so.1: cannot open shared object file: No such file or directory”. I have no root access, so I have to downgrade llvm until 10.

Thanks for your time

the details about my env and process I build tvm are below:

1. linux version: CentOS Linux release 7.6.1810 (Core)
2. linux kernel version: 3.10.0-957.el7.x86_64
3. pre-built binary I use: clang+llvm-10.0.0-x86_64-linux-sles11.3.tar.xz
4. python: 3.7.13
5. gcc: 9.3
6. how to build tvm:
    mkdir build
    set LLVM to ON in cmake/config.cmake
    cp cmake/config.cmake build
    cd build
    cmake ..
    make -j8

thanks, I solved it by building llvm source code