-
tensorflow error - undefined symbol: _ZTIN10tensorflow8OpKernelEdev/tensorflow 2018. 1. 10. 20:11
error message
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/load_library.py", line 56, in load_op_library
lib_handle = py_tf.TF_LoadLibrary(library_filename, status)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/errors_impl.py", line 473, in __exit__
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.NotFoundError: XXX.so : undefined symbol: _ZTIN10tensorflow8OpKernelE
solution
: add compile option -L[tensorflow library location] -ltensorflow_framework
EXAMPLE
TF_LIB=$(python -c 'import tensorflow; print(tensorflow.sysconfig.get_lib())')
g++ -std=c++11 mycode.cpp mycode_g.cu.o -o mycode_so.so -shared -fPIC -I /usr/local/lib/python2.7/dist-packages/tensorflow/include -I /usr/local/cuda-8.0/include -lcudart -L /usr/local/cuda-8.0/lib64/ -O2 -D_GLIBCXX_USE_CXX11_ABI=0 -L$TF_LIB -ltensorflow_framework