Skip to content

TF2.6 compile error with custom eigen repo #53002

@axiqia

Description

@axiqia

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): Centos7
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device:
  • TensorFlow installed from (source or binary): source
  • TensorFlow version: r2.6
  • Python version: Python 3.6.8
  • Installed using virtualenv? pip? conda?: pip
  • Bazel version (if compiling from source): bazel 3.7.2
  • GCC/Compiler version (if compiling from source): gcc version 6.5.1 20190307
  • CUDA/cuDNN version:
  • GPU model and memory:

Describe the problem
Hi, guys,
I want to compile tensorflow r2.6 with a custom eigen. But it occurs errors.

Provide the exact sequence of commands / steps that you executed before running into the problem
TF r2.6 is compiled successfully.

#bazel build  //tensorflow/tools/pip_package:build_pip_package
...
INFO: Found applicable config definition build:v2 in file /tensorflow/.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
INFO: Found applicable config definition build:linux in file /tensorflow/.bazelrc: --copt=-w --host_copt=-w --define=PREFIX=/usr --define=LIBDIR=$(PREFIX)/lib --define=INCLUDEDIR=$(PREFIX)/include --define=PROTOBUF_INCLUDE_PATH=$(PREFIX)/include --cxxopt=-std=c++14 --host_cxxopt=-std=c++14 --config=dynamic_kernels --distinct_host_configuration=false
INFO: Found applicable config definition build:dynamic_kernels in file /tensorflow/.bazelrc: --define=dynamic_loaded_kernels=true --copt=-DAUTOLOAD_DYNAMIC_KERNELS
DEBUG: /root/.cache/bazel/_bazel_root/68a62076e91007a7908bc42a32e4cff9/external/tf_runtime/third_party/cuda/dependencies.bzl:51:10: The following command will download NVIDIA proprietary software. By using the software you agree to comply with the terms of the license agreement that accompanies the software. If you do not agree to the terms of the license agreement, do not use the software.
INFO: Analyzed target //tensorflow/tools/pip_package:build_pip_package (430 packages loaded, 26907 targets configured).
INFO: Found 1 target...
Target //tensorflow/tools/pip_package:build_pip_package up-to-date:
  bazel-bin/tensorflow/tools/pip_package/build_pip_package
INFO: Elapsed time: 634.229s, Critical Path: 344.77s
INFO: 7345 processes: 387 internal, 6958 local.
INFO: Build completed successfully, 7345 total actions

Based on the same environment, I modified eigen workspace.bzl of TF r26.

--- a/third_party/eigen3/workspace.bzl
+++ b/third_party/eigen3/workspace.bzl
@@ -9,13 +9,19 @@ def repo():
     EIGEN_COMMIT = "12e8d57108c50d8a63605c6eb0144c838c128337"
     EIGEN_SHA256 = "f689246e342c3955af48d26ce74ac34d21b579a00675c341721a735937919b02"
 
-    tf_http_archive(
-        name = "eigen_archive",
-        build_file = "//third_party/eigen3:eigen_archive.BUILD",
-        sha256 = EIGEN_SHA256,
-        strip_prefix = "eigen-{commit}".format(commit = EIGEN_COMMIT),
-        urls = [
-            "https://storage.googleapis.com/mirror.tensorflow.org/gitlab.com/libeigen/eigen/-/archive/{commit}/eigen-{commit}.tar.gz".format(commit = EIGEN_COMMIT),
-            "https://gitlab.com/libeigen/eigen/-/archive/{commit}/eigen-{commit}.tar.gz".format(commit = EIGEN_COMMIT),
-        ],
-    )
+    native.new_local_repository(
+       name = "eigen_archive",
+       path = "/mnt/eigen",
+       build_file = "//third_party/eigen3:eigen_archive.BUILD",
+    )

Then I checkout the eigen repo to the same commit id 12e8d57108c50d8a63605c6eb0144c838c128337

$ cd /mnt/eigen
$ git remote -vvv
origin  https://gitlab.com/libeigen/eigen.git (fetch)
origin  https://gitlab.com/libeigen/eigen.git (push)
$ git checkout -b current 12e8d57108c50d8a63605c6eb0144c838c128337

But got an error:

INFO: Analyzed target //tensorflow/tools/pip_package:build_pip_package (430 packages loaded, 26907 targets configured).
INFO: Found 1 target...
ERROR: /tensorflow/tensorflow/core/grappler/costs/BUILD:67:11: C++ compilation of rule '//tensorflow/core/grappler/costs:graph_properties' failed (Exit 1): gcc failed: error executing command
  (cd /root/.cache/bazel/_bazel_root/68a62076e91007a7908bc42a32e4cff9/execroot/org_tensorflow && \
  exec env - \
    LD_LIBRARY_PATH=/usr/local/nvidia/lib64:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/lib64::/usr/lib/python2.7/site-packages/tensorflow \
    PATH=/opt/zookeeper/bin:/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/tops/bin:/opt/zookeeper/bin:/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/tops/bin:/usr/X11R6/bin:/opt/satools \
    PWD=/proc/self/cwd \
    PYTHON_BIN_PATH=/home/tops/bin/python3 \
    PYTHON_LIB_PATH=/home/tops/lib/python3.6/site-packages \
    TF2_BEHAVIOR=1 \
  /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections -fdata-sections '-std=c++11' -MD -MF bazel-out/k8-opt/bin/tensorflow/core/grappler/costs/_objs/graph_properties/graph_properties.pic.d '-frandom-seed=bazel-out/k8-opt/bin/tensorflow/core/grappler/costs/_objs/graph_properties/graph_properties.pic.o' -fPIC -DHAVE_SYS_UIO_H -DTF_USE_SNAPPY -DEIGEN_MPL2_ONLY '-DEIGEN_MAX_ALIGN_BYTES=64' -iquote. -iquotebazel-out/k8-opt/bin -iquoteexternal/com_google_absl -iquotebazel-out/k8-opt/bin/external/com_google_absl -iquoteexternal/nsync -iquotebazel-out/k8-opt/bin/external/nsync -iquoteexternal/eigen_archive -iquotebazel-out/k8-opt/bin/external/eigen_archive -iquoteexternal/gif -iquotebazel-out/k8-opt/bin/external/gif -iquoteexternal/libjpeg_turbo -iquotebazel-out/k8-opt/bin/external/libjpeg_turbo -iquoteexternal/com_google_protobuf -iquotebazel-out/k8-opt/bin/external/com_google_protobuf -iquoteexternal/com_googlesource_code_re2 -iquotebazel-out/k8-opt/bin/external/com_googlesource_code_re2 -iquoteexternal/farmhash_archive -iquotebazel-out/k8-opt/bin/external/farmhash_archive -iquoteexternal/fft2d -iquotebazel-out/k8-opt/bin/external/fft2d -iquoteexternal/highwayhash -iquotebazel-out/k8-opt/bin/external/highwayhash -iquoteexternal/zlib -iquotebazel-out/k8-opt/bin/external/zlib -iquoteexternal/double_conversion -iquotebazel-out/k8-opt/bin/external/double_conversion -iquoteexternal/snappy -iquotebazel-out/k8-opt/bin/external/snappy -isystem external/nsync/public -isystem bazel-out/k8-opt/bin/external/nsync/public -isystem third_party/eigen3/mkl_include -isystem bazel-out/k8-opt/bin/third_party/eigen3/mkl_include -isystem external/eigen_archive -isystem bazel-out/k8-opt/bin/external/eigen_archive -isystem external/gif -isystem bazel-out/k8-opt/bin/external/gif -isystem external/com_google_protobuf/src -isystem bazel-out/k8-opt/bin/external/com_google_protobuf/src -isystem external/farmhash_archive/src -isystem bazel-out/k8-opt/bin/external/farmhash_archive/src -isystem external/zlib -isystem bazel-out/k8-opt/bin/external/zlib -isystem external/double_conversion -isystem bazel-out/k8-opt/bin/external/double_conversion -w -DAUTOLOAD_DYNAMIC_KERNELS '-std=c++14' -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c tensorflow/core/grappler/costs/graph_properties.cc -o bazel-out/k8-opt/bin/tensorflow/core/grappler/costs/_objs/graph_properties/graph_properties.pic.o)
Execution platform: @local_execution_config_platform//:platform
tensorflow/core/grappler/costs/graph_properties.cc: In member function 'tensorflow::Status tensorflow::grappler::{anonymous}::DisjointSet<Handle>::Merge(Handle, Handle)':
tensorflow/core/grappler/costs/graph_properties.cc:236:30: error: type/value mismatch at argument 1 in template parameter list for 'template<class> struct std::rank'
   if (x_root->rank < y_root->rank) {
                              ^~~~
tensorflow/core/grappler/costs/graph_properties.cc:236:30: note:   expected a type, got 'y_root->.rank'
Target //tensorflow/tools/pip_package:build_pip_package failed to build
INFO: Elapsed time: 74.775s, Critical Path: 63.70s
INFO: 457 processes: 97 internal, 360 local.
FAILED: Build did NOT complete successfully

It really confused me. The error occurs in tensorflow/core/grappler/costs/graph_properties.cc.
Any response is welcomed. Thank you.

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.

Metadata

Metadata

Labels

2.6.0staleThis label marks the issue/pr stale - to be closed automatically if no activitystat:awaiting responseStatus - Awaiting response from authorsubtype:centosCentos Build/Installation issuestype:build/installBuild and install issues

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions