user577905
user577905

Reputation: 183

Unable to compile Tensorflow from source on Ubuntu 18.04

When I attempt to compile TensorFlow from source I get the following error. I'm using the GPU Docker image to run the build. Which in theory has all of the proper dependencies set up.

The host machine(s) is Ubuntu 18.04. I'm receiving this issue on two different machines that both have the latest Nvidia drivers. One has a 1080 TI and the other has a 1060 nvidia card.

Building a docker image based on: tensorflow/tensorflow:1.11.0-devel-gpu.

I run it in interactive mode and run ./configure.

This is the configuration:

./configure
WARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command "bazel shutdown".
You have bazel 0.15.0 installed.
Please specify the location of python. [Default is /usr/bin/python]: 


Found possible Python library paths:
  /usr/local/lib/python2.7/dist-packages
  /usr/lib/python2.7/dist-packages
Please input the desired Python library path to use.  Default is [/usr/local/lib/python2.7/dist-packages]

Do you wish to build TensorFlow with jemalloc as malloc support? [Y/n]: y
jemalloc as malloc support will be enabled for TensorFlow.

Do you wish to build TensorFlow with Google Cloud Platform support? [Y/n]: y
Google Cloud Platform support will be enabled for TensorFlow.

Do you wish to build TensorFlow with Hadoop File System support? [Y/n]: y
Hadoop File System support will be enabled for TensorFlow.

Do you wish to build TensorFlow with Amazon AWS Platform support? [Y/n]: y
Amazon AWS Platform support will be enabled for TensorFlow.

Do you wish to build TensorFlow with Apache Kafka Platform support? [Y/n]: y
Apache Kafka Platform support will be enabled for TensorFlow.

Do you wish to build TensorFlow with XLA JIT support? [y/N]: y
XLA JIT support will be enabled for TensorFlow.

Do you wish to build TensorFlow with GDR support? [y/N]: y
GDR support will be enabled for TensorFlow.

Do you wish to build TensorFlow with VERBS support? [y/N]: y
VERBS support will be enabled for TensorFlow.

Do you wish to build TensorFlow with nGraph support? [y/N]: y
nGraph support will be enabled for TensorFlow.

Do you wish to build TensorFlow with OpenCL SYCL support? [y/N]: n
No OpenCL SYCL support will be enabled for TensorFlow.

Please specify the location where CUDA 9.0 toolkit is installed. Refer to README.md for more details. [Default is /usr/local/cuda]: 


Please specify the location where cuDNN 7 library is installed. Refer to README.md for more details. [Default is /usr/local/cuda]: 


Please specify the location where TensorRT is installed. [Default is /usr/lib/x86_64-linux-gnu]:


Please specify the location where NCCL 2 library is installed. Refer to README.md for more details. [Default is /usr/local/cuda]:


Do you want to use clang as CUDA compiler? [y/N]: n
nvcc will be used as CUDA compiler.

Please specify which gcc should be used by nvcc as the host compiler. [Default is /usr/bin/gcc]: 


Do you wish to build TensorFlow with MPI support? [y/N]: n
No MPI support will be enabled for TensorFlow.

Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -march=native]: 


Would you like to interactively configure ./WORKSPACE for Android builds? [y/N]: n
Not configuring the WORKSPACE for Android builds.

Preconfigured Bazel build configs. You can use any of the below by adding "--config=<>" to your build command. See tools/bazel.rc for more details.
        --config=mkl            # Build with MKL support.
        --config=monolithic     # Config for mostly static monolithic build.
Configuration finished
root@17ed0ddbe2a4:/tensorflow# 

This is the error I get.

ERROR: /root/.cache/bazel/_bazel_root/68a62076e91007a7908bc42a32e4cff9/external/ngraph_tf/BUILD.bazel:19:1: C++ compilation of rule '@ngraph_tf//:ngraph_tf' failed (Exit 1)
In file included from external/org_tensorflow/tensorflow/core/framework/common_shape_fns.h:22:0,
                 from external/org_tensorflow/tensorflow/core/framework/resource_mgr.h:24,
                 from external/org_tensorflow/tensorflow/core/common_runtime/device.h:43,
                 from external/org_tensorflow/tensorflow/core/common_runtime/device_set.h:23,
                 from external/org_tensorflow/tensorflow/core/common_runtime/optimization_registry.h:25,
                 from external/ngraph_tf/src/ngraph_encapsulate_pass.cc:23:
external/org_tensorflow/tensorflow/core/util/tensor_format.h: In function 'tensorflow::TensorShape tensorflow::ShapeFromFormat(tensorflow::TensorFormat, tensorflow::int64, tensorflow::gtl::ArraySlice<long long int>, tensorflow::int64)':
external/org_tensorflow/tensorflow/core/util/tensor_format.h:501:45: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (format == FORMAT_NHWC_VECT_W && dim == spatial.size() - 1) {
                                             ^
external/ngraph_tf/src/ngraph_encapsulate_pass.cc: In member function 'tensorflow::Status ngraph_bridge::NGraphEncapsulatePass::EncapsulateFunctions(tensorflow::Graph*)':
external/ngraph_tf/src/ngraph_encapsulate_pass.cc:393:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
           if (i < node->requested_inputs().size()) {
                 ^
external/ngraph_tf/src/ngraph_encapsulate_pass.cc:414:42: error: 'class absl::string_view' has no member named 'ToString'
             cluster_idx, tensor_id.first.ToString(), tensor_id.second));
                                          ^
In file included from external/org_tensorflow/tensorflow/core/platform/default/logging.h:24:0,
                 from external/org_tensorflow/tensorflow/core/platform/logging.h:25,
                 from external/org_tensorflow/tensorflow/core/lib/core/refcount.h:22,
                 from external/org_tensorflow/tensorflow/core/platform/tensor_coding.h:21,
                 from external/org_tensorflow/tensorflow/core/framework/resource_handle.h:19,
                 from external/org_tensorflow/tensorflow/core/framework/allocator.h:24,
                 from external/org_tensorflow/tensorflow/core/common_runtime/device.h:35,
                 from external/org_tensorflow/tensorflow/core/common_runtime/device_set.h:23,
                 from external/org_tensorflow/tensorflow/core/common_runtime/optimization_registry.h:25,
                 from external/ngraph_tf/src/ngraph_encapsulate_pass.cc:23:
external/org_tensorflow/tensorflow/core/util/tensor_format.h: In instantiation of 'T tensorflow::GetTensorDim(tensorflow::gtl::ArraySlice<T>, tensorflow::TensorFormat, char) [with T = long long int; tensorflow::gtl::ArraySlice<T> = absl::Span<const long long int>]':
external/org_tensorflow/tensorflow/core/util/tensor_format.h:452:47:   required from here
external/org_tensorflow/tensorflow/core/util/tensor_format.h:420:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   CHECK(index >= 0 && index < dimension_attributes.size())
                             ^
external/org_tensorflow/tensorflow/core/platform/macros.h:87:47: note: in definition of macro 'TF_PREDICT_FALSE'
 #define TF_PREDICT_FALSE(x) (__builtin_expect(x, 0))
                                               ^
external/org_tensorflow/tensorflow/core/util/tensor_format.h:420:3: note: in expansion of macro 'CHECK'
   CHECK(index >= 0 && index < dimension_attributes.size())
   ^
external/org_tensorflow/tensorflow/core/util/tensor_format.h: In instantiation of 'T tensorflow::GetFilterDim(tensorflow::gtl::ArraySlice<T>, tensorflow::FilterTensorFormat, char) [with T = long long int; tensorflow::gtl::ArraySlice<T> = absl::Span<const long long int>]':
external/org_tensorflow/tensorflow/core/util/tensor_format.h:461:54:   required from here
external/org_tensorflow/tensorflow/core/util/tensor_format.h:435:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   CHECK(index >= 0 && index < dimension_attribute.size())
                             ^
external/org_tensorflow/tensorflow/core/platform/macros.h:87:47: note: in definition of macro 'TF_PREDICT_FALSE'
 #define TF_PREDICT_FALSE(x) (__builtin_expect(x, 0))
                                               ^
external/org_tensorflow/tensorflow/core/util/tensor_format.h:435:3: note: in expansion of macro 'CHECK'
   CHECK(index >= 0 && index < dimension_attribute.size())
   ^
Target //tensorflow/tools/pip_package:build_pip_package failed to build

I get the same problem with a 1.10 image too. Or trying to build either 1.10 or 1.11 from source directly on the host.

Upvotes: 3

Views: 552

Answers (1)

bpinaya
bpinaya

Reputation: 609

it seems it was solved on this commit here.

Check also the thread where it was mentioned in the first place https://github.com/tensorflow/tensorflow/issues/22583

Just pull from master and try to rebuild again.

Upvotes: 2

Related Questions