ubuntu 18.04 64bit build tensorflow report error:C++ compilation of rule '//tensorflow/core/kernels:broadcast_to_op' failed ,Exit 4

注意:笔者未能在Ubuntu18.04 64bit下成功从源码编译cpu版本的tensorflow

Ans: 1.You are likely running out of memory. Try reducing number of parallel builds by passing '--local_resources 2048,.5,1.0', which would instruct bazel to spawn no more than one compiler process at the time.

2. sudo apt-get install gcc-6 g++-6

    cd /usr/bin

    sudo mv gcc gcc-7.3.0.back

    sudo ln -s gcc-6 gcc

    sudo mv g++ g++-7.3.0.back

    sudo ln -s g++-6 g++

  3. sudo mv ~/.cache/bazel ~/.cache/bazel.back

Reference material:

Building from source, gcc issues