问题描述
我正在按照TensorFlow 从源代码安装"说明.
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.
我收到以下错误:
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:
...
堆栈:运行Ubuntu 14.04.2.的EC2 g2.8xlarge机器. Bazel版本0.1.5(使用bazel-0.1.5-jdk7-installer-linux-x86_64.sh
安装).
Stack: EC2 g2.8xlarge machine running Ubuntu 14.04.2. Bazel version 0.1.5 (installed w/ bazel-0.1.5-jdk7-installer-linux-x86_64.sh
).
我尝试了Bazel 0.1.4和0.2.3,但遇到了相同的错误.
I've tried Bazel 0.1.4 and 0.2.3 and I get the same error.
推荐答案
我在Ubuntu 16.04中构建tensorflow时遇到了相同的问题.
I had the same issue building tensorflow in Ubuntu 16.04.
首先请确保您使用的是gcc版本< = 4.8
First of all ensure that you are using gcc version <= 4.8
就我而言,我必须安装它:
In my case I had to install it doing:
对于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
对于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
一旦有了正确版本的gcc和g ++,我就必须按如下方式编辑CROSSTOOL文件:
Once having the right version of gcc and g++, I had to edit the CROSSTOOL file as follows:
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"
因此结果必须是:
cxx_flag: "-D_FORCE_INLINES"
tool_path { name: "gcc" path: "clang/bin/crosstool_wrapper_driver_is_not_gcc" }
这篇关于TensorFlow Bazel构建失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!