tensorflow: tensorflow 2.1 build error
Please make sure that this is a build/installation issue. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:build_template
System information
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): ubuntu 18.04
- Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: N/A
- TensorFlow installed from (source or binary): source 2.1
- TensorFlow version: 2.1.0
- Python version: 3.7.6
- Installed using virtualenv? pip? conda?: N/A
- Bazel version (if compiling from source): 0.29.1
- GCC/Compiler version (if compiling from source): 7.4.0
- CUDA/cuDNN version: 10.2/ 7.6.5
- GPU model and memory: RTX2080Ti GDDR6 11GB
Describe the problem
Provide the exact sequence of commands / steps that you executed before running into the problem
bazel build //tensorflow/tools/pip_package:build_pip_packagee
Any other info / logs Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.
ERROR: /home/wmind/repo/tensorflow/tensorflow/python/BUILD:1270:1: C++ compilation of rule '//tensorflow/python:_op_def_registry.so' failed (Exit 1)
In file included from bazel-out/k8-opt/bin/external/local_config_python/python_include/pybind11/pytypes.h:12:0,
from bazel-out/k8-opt/bin/external/local_config_python/python_include/pybind11/cast.h:13,
from bazel-out/k8-opt/bin/external/local_config_python/python_include/pybind11/attr.h:13,
from bazel-out/k8-opt/bin/external/local_config_python/python_include/pybind11/pybind11.h:44,
from ./tensorflow/python/lib/core/pybind11_status.h:21,
from tensorflow/python/framework/op_def_registry.cc:20:
bazel-out/k8-opt/bin/external/local_config_python/python_include/pybind11/detail/common.h:302:12: error: multiple definition of ‘enum class pybind11::return_value_policy’
enum class return_value_policy : uint8_t {
^~~~~~~~~~~~~~~~~~~
In file included from external/pybind11/include/pybind11/pytypes.h:12:0,
from external/pybind11/include/pybind11/cast.h:13,
from external/pybind11/include/pybind11/attr.h:13,
from external/pybind11/include/pybind11/pybind11.h:49,
from tensorflow/python/framework/op_def_registry.cc:16:
external/pybind11/include/pybind11/detail/common.h:302:12: note: previous definition here
enum class return_value_policy : uint8_t {
^~~~~~~~~~~~~~~~~~~
In file included from bazel-out/k8-opt/bin/external/local_config_python/python_include/pybind11/pytypes.h:12:0,
from bazel-out/k8-opt/bin/external/local_config_python/python_include/pybind11/cast.h:13,
from bazel-out/k8-opt/bin/external/local_config_python/python_include/pybind11/attr.h:13,
from bazel-out/k8-opt/bin/external/local_config_python/python_include/pybind11/pybind11.h:44,
from ./tensorflow/python/lib/core/pybind11_status.h:21,
from tensorflow/python/framework/op_def_registry.cc:20:
bazel-out/k8-opt/bin/external/local_config_python/python_include/pybind11/detail/common.h: In function ‘constexpr int pybind11::detail::log2(pybind11::size_t, int)’:
bazel-out/k8-opt/bin/external/local_config_python/python_include/pybind11/detail/common.h:355:29: error: redefinition of ‘constexpr int pybind11::detail::log2(pybind11::size_t, int)’
inline static constexpr int log2(size_t n, int k = 0) { return (n <= 1) ? k : log2(n >> 1, k + 1); }
^~~~
In file included from external/pybind11/include/pybind11/pytypes.h:12:0,
from external/pybind11/include/pybind11/cast.h:13,
from external/pybind11/include/pybind11/attr.h:13,
from external/pybind11/include/pybind11/pybind11.h:49,
from tensorflow/python/framework/op_def_registry.cc:16:
external/pybind11/include/pybind11/detail/common.h:355:29: note: ‘constexpr int pybind11::detail::log2(pybind11::size_t, int)’ previously defined here
inline static constexpr int log2(size_t n, int k = 0) { return (n <= 1) ? k : log2(n >> 1, k + 1); }
^~~~
In file included from bazel-out/k8-opt/bin/external/local_config_python/python_include/pybind11/pytypes.h:12:0,
from bazel-out/k8-opt/bin/external/local_config_python/python_include/pybind11/cast.h:13,
from bazel-out/k8-opt/bin/external/local_config_python/python_include/pybind11/attr.h:13,
from bazel-out/k8-opt/bin/external/local_config_python/python_include/pybind11/pybind11.h:44,
from ./tensorflow/python/lib/core/pybind11_status.h:21,
from tensorflow/python/framework/op_def_registry.cc:20:
bazel-out/k8-opt/bin/external/local_config_python/python_include/pybind11/detail/common.h: In function ‘constexpr pybind11::size_t pybind11::detail::size_in_ptrs(pybind11::size_t)’:
bazel-out/k8-opt/bin/external/local_config_python/python_include/pybind11/detail/common.h:358:32: error: redefinition of ‘constexpr pybind11::size_t pybind11::detail::size_in_ptrs(pybind11::size_t)’
inline static constexpr size_t size_in_ptrs(size_t s) { return 1 + ((s - 1) >> log2(sizeof(void *))); }
^~~~~~~~~~~~
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (7 by maintainers)
It’s a bundled libs problem. If pybind11 is installed with pip first, then those headers get picked up by
@local_config_python//:python_headersand the pybind headers are duplicated and things go wrong. I’ve unbundled pybind in gentoo and it fixes it, i’ll send a PR upstream soon to fix it in TF too, it needs some reworking because the#includepaths are off in TFI am seeing a very similar error to the one reported here, this time on macOS 10.15 with Xcode 11.3 clang
issue appears to be due to two different locations for
pybind11being used.@mihaimaruseac
build succeeded without tensorrt in master
I can’t in the near future, I’m currently compiling v2.1.0 patched to expect pybind11 v2.4.3 to see if it completes when the versions match.
What I think is happening here is that tensorflow/workspace.bzl specifies pybind11 v2.3.0 but some other part of the machinery just resolves a pybind11 dependency as latest. This would have stopped working reliably on Sep 20, 2019 when v2.4.0 became the latest.
As of this writing
masterstill specifies pybind11 v2.3.0 so for it to work here such a dependency would have to have been fixed or removed.