Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"undefined symbol" when compiling the example Op #9137

Closed
idofr opened this issue Apr 11, 2017 · 7 comments
Closed

"undefined symbol" when compiling the example Op #9137

idofr opened this issue Apr 11, 2017 · 7 comments
Labels
type:build/install Build and install issues type:support Support issues

Comments

@idofr
Copy link

idofr commented Apr 11, 2017

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow)?: No
  • TensorFlow installed from (source or binary)?: binary
  • TensorFlow version: 1.0.1
  • Bazel version (if compiling from source): NA
  • CUDA/cuDNN version: NA
  • GPU Model and Memory: NA
  • Exact command to reproduce:

Describe the problem clearly

Trying to build and compile the example in "adding a new op"
https://www.tensorflow.org/extend/adding_an_op
This was moved to
tensorflow/examples/adding_an_op
and was not updated in the tutorial page.
After compiling the zero_out_op_kernel_1.cc example, I'm trying to run the zero_out_1_test.py. Yet this returns the following error

File "zero_out_1_test.py", line 25, in
import zero_out_op_1
File "/home/me/tf_compile/tensorflow/tensorflow/examples/adding_an_op/zero_out_op_1.py", line 26, in
'zero_out_op_kernel_1.so'))
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/load_library.py", line 64, in load_op_library
None, None, error_msg, error_code)
tensorflow.python.framework.errors_impl.NotFoundError: /home/me/tf_compile/tensorflow/tensorflow/examples/adding_an_op/zero_out_op_kernel_1.so: undefined symbol: _ZN10tensorflow8internal21CheckOpMessageBuilder9NewStringB5cxx11Ev

Any ideas what could that symbol be?

@jart
Copy link
Contributor

jart commented Apr 12, 2017

I tried the example with 1.0.1 and it worked for me. You might be using an unsupported operating system which has a weird version of GCC. We support Ubuntu Linux 14 LTE to 16. Mac OS X El Capitan. CentOS 7 and above.

@jart jart closed this as completed Apr 12, 2017
@jart jart added the type:support Support issues label Apr 12, 2017
@idofr
Copy link
Author

idofr commented Apr 12, 2017

I'm using Ubuntu 16 with GCC 5.
Could it be that one of the headers was not compiled correctly?

@jart
Copy link
Contributor

jart commented Apr 12, 2017

Interesting. So you installed the TensorFlow binary distro, which was probably built using GCC 4.x. Then compiled a custom op using GCC 5.x. Out of curiosity, could you try apt-get installing the GCC 4.x series and see if it works? If so, then I might want to bring to the attention of some other people that a binary compatibility problem exists.

@jart jart added the type:build/install Build and install issues label Apr 12, 2017
@idofr
Copy link
Author

idofr commented Apr 12, 2017

Sure, thanks for the quick response. I'll give it a try either tonight or tomorrow at some point and will let you know

@shashankneocfc
Copy link

shashankneocfc commented Apr 14, 2017

I've the exact same problem : ' undefined symbol: _ZN10tensorflow8internal21CheckOpMessageBuilder9NewStringEv' .

Does '_ZN10tensorflow8internal21CheckOpMessageBuilder9NewStringEv' have a different error meaning with respect to '_ZN10tensorflow8internal21CheckOpMessageBuilder9NewStringB5cxx11Ev' ?

We've defined our own custom op and our code works successfully with tensorflow 0.12.1 and it crashes with the above error with tensorflow 1.0.0. I'm using Ubuntu 16 with gcc version 5.4.
@idofr Did your problem get solved with gcc 4 ?

Edit:
Following link solved my problem :
deepsense-ai/roi-pooling#1

@jart
Copy link
Contributor

jart commented Apr 14, 2017

@shashankneocfc Thanks for reporting back with the solution.

It turns out we have the magic incantation -D_GLIBCXX_USE_CXX11_ABI=0 in our pip installation and adding an op documentation. Those error messages are really worrisome, but I'm not sure what we can do to make this easier for users.

@Afzal786
Copy link

I am facing this problem while adding a custom ops.

lib_handle = py_tf.TF_LoadLibrary(library_filename)
tensorflow.python.framework.errors_impl.NotFoundError: /home/afzal786/PycharmProjects/multi/venv/lib/python3.6/site-packages/multidim_image_augmentation/python/ops/_augmentation_ops.so: undefined symbol: _ZN10tensorflow8internal21CheckOpMessageBuilder9NewStringB5cxx11Ev

undefined symbol: _ZN10tensorflow8internal21CheckOpMessageBuilder9NewStringB5cxx11Ev
gcc and ubuntu version:
gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0

TensorFlow version 2.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:build/install Build and install issues type:support Support issues
Projects
None yet
Development

No branches or pull requests

4 participants