简体   繁体   English

TensorFlow Bazel构建失败

[英]TensorFlow Bazel build failing

I'm building TensorFlow with Bazel using bazel build -c opt --config=cuda //tensorflow/cc:tutorials_example_trainer as instructed to by the TensorFlow 'installing from sources' instructions . 我正在使用bazel build -c opt --config=cuda //tensorflow/cc:tutorials_example_trainer使用bazel build -c opt --config=cuda //tensorflow/cc:tutorials_example_trainer TensorFlow,按照TensorFlow 从源代码说明安装的指示

I get the following error: 我收到以下错误:

    ERROR: /home/ubuntu/tensorflow/tensorflow/stream_executor/BUILD:5:1: C++ compilation of rule '//tensorflow/stream_executor:stream_e
xecutor' failed: crosstool_wrapper_driver_is_not_gcc failed: error executing command third_party/gpus/crosstool/clang/bin/crosstool
_wrapper_driver_is_not_gcc -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -fPIE -Wall -Wunused-but-set-parameter -Wno-fr
ee-nonheap-object ... (remaining 87 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exite
d with status 1.   

tensorflow/stream_executor/cuda/cuda_dnn.cc: In function 'cudnnConvolutionFwdAlgo_t perftools::gputools::cuda::{anonymous}::ToConvF
orwardAlgo(perftools::gputools::dnn::AlgorithmType)':                                                                              
tensorflow/stream_executor/cuda/cuda_dnn.cc:269:10: error: 'CUDNN_CONVOLUTION_FWD_ALGO_FFT' was not declared in this scope         
     case CUDNN_CONVOLUTION_FWD_ALGO_FFT:  

...

Stack: EC2 g2.8xlarge machine running Ubuntu 14.04.2. 堆栈:运行Ubuntu 14.04.2的EC2 g2.8xlarge机器。 Bazel version 0.1.5 (installed w/ bazel-0.1.5-jdk7-installer-linux-x86_64.sh ). Bazel版本0.1.5(安装时带有bazel-0.1.5-jdk7-installer-linux-x86_64.sh )。

I've tried Bazel 0.1.4 and 0.2.3 and I get the same error. 我尝试过Bazel 0.1.4和0.2.3,我得到了同样的错误。

I had the same issue building tensorflow in Ubuntu 16.04. 我有同样的问题在Ubuntu 16.04中构建tensorflow。

First of all ensure that you are using gcc version <= 4.8 首先确保您使用的是gcc版本<= 4.8

In my case I had to install it doing: 在我的情况下,我不得不安装它:

For gcc 对于gcc

sudo apt-get install gcc-4.8
sudo update-alternatives --remove-all gcc
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 10

For g++ 对于g ++

sudo apt-get install g++-4.8
sudo update-alternatives --remove-all g++
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 10

Once having the right version of gcc and g++, I had to edit the CROSSTOOL file as follows: 一旦拥有正确版本的gcc和g ++,我就必须编辑CROSSTOOL文件,如下所示:

gedit tensorflow_sources_folder/third_party/gpus/crosstool/CROSSTOOL

Search every ocurrence of this specific line: 搜索此特定行的每个发生:

tool_path { name: "gcc" path: "clang/bin/crosstool_wrapper_driver_is_not_gcc" }

And insert the following line exactly above it: 并在其正上方插入以下行:

cxx_flag: "-D_FORCE_INLINES"

So the result must be: 所以结果必须是:

cxx_flag: "-D_FORCE_INLINES"
tool_path { name: "gcc" path: "clang/bin/crosstool_wrapper_driver_is_not_gcc" }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM