Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

undefined symbol: _ZTIN10tensorflow8OpKernelE

I just updated tensorflow with pip3 (now to version 1.4.1). After it I am having problems:

I have a custom op library that I compile with -D _GLIBCXX_USE_CXX11_ABI=0. The library compiles and links fine. Importing it into tensorflow gives:

Traceback (most recent call last):
  ...
  File "../x.py", line 29, in <module>
    lib = tf.load_op_library(_lib_path)
  File "/home/ilge/.local/lib/python3.5/site-packages/tensorflow/python/framework/load_library.py", line 56, in load_op_library
    lib_handle = py_tf.TF_LoadLibrary(library_filename, status)
  File "/home/ilge/.local/lib/python3.5/site-packages/tensorflow/python/framework/errors_impl.py", line 473, in __exit__
    c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.NotFoundError: /path/to/mylib.so: undefined symbol: _ZTIN10tensorflow8OpKernelE

It seems it cannot load general tensorflow symbols. Hints on how I could debug it are very appreciated. Note that before the update and before recompiling everything was working.

like image 416
Eddy Avatar asked Oct 24 '25 10:10

Eddy


1 Answers

See the updated custom op instructions: https://www.tensorflow.org/extend/adding_an_op#compile_the_op_using_your_system_compiler_tensorflow_binary_installation

In particular:

>>> tf.sysconfig.get_link_flags()
['-L/usr/local/lib/python3.6/dist-packages/tensorflow', '-ltensorflow_framework']

Custom ops are now (in TensorFlow 1.4+) registered by linking against libtensorflow_framework.so. Previously TensorFlow loaded the necessary symbols into the global symbol table for the Python process (using RTLD_GLOBAL).

like image 189
Allen Lavoie Avatar answered Oct 27 '25 04:10

Allen Lavoie