tensorflow: Undefined symbol in debug mode

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 18.04
  • TensorFlow installed from (source or binary): source
  • TensorFlow version: v2.2.0-rc3
  • Python version: 3.6.9
  • Installed using virtualenv? pip? conda?: pip
  • Bazel version (if compiling from source): 2.0.0
  • GCC/Compiler version (if compiling from source): gcc 7.5.0
  • CUDA/cuDNN version: N/A
  • GPU model and memory: N/A

Tensorflow was built inside the ‘tensorflow/tensorflow:devel-py3’ docker image with digest 0285d09f16ff

Describe the problem

After building tensorflow w/ debug info, tensorflow fails when imported with the following error:

ImportError: /usr/local/lib/python3.6/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so: 
undefined symbol: _ZN10tensorflow4data12experimental14SnapshotReader34kSnappyReaderOutputBufferSizeBytesE 

Provide the exact sequence of commands / steps that you executed before running into the problem

  1. I cherry picked https://github.com/tensorflow/tensorflow/pull/39239/commits/cd8b64f7fbdc2bc8700b71dadb4c51744a752095 to fix https://github.com/tensorflow/tensorflow/issues/37498
  2. bazel build --config=dbg --strip=never //tensorflow/tools/pip_package:build_pip_package
  3. ./bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
  4. cd /tmp/tensorflow_pkg
  5. pip3 install tensorflow-2.2.0rc3-cp36-cp36m-linux_x86_64.whl
  6. python3 -c ‘import tensorflow’

If there is anything else worth providing (readelf output?) please let me know

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 35 (3 by maintainers)

Most upvoted comments

I am suffering from the same issue. Can you please enable the debug build? it helps a lot to be able to debug when trying to learn the internal implementation.

I finally succeeded compile the debug mode of tf2.3.0 by using “bazel build -c opt --copt=-g”

Could you share your complete “bazel build” command?

bazel build -c opt --copt=-g //tensorflow/tools/pip_package:build_pip_package --verbose_failures