0

I get build errors when I do the following. I need to build Tensorflow because I'm trying to add my own ops. I get the same error also without using "-c opt". What am I doing wrong?

$ docker run -it b.gcr.io/tensorflow/tensorflow-full
root@3b2b67124684:~# cd /tensorflow/
root@3b2b67124684:/tensorflow# ./configure
Do you wish to build TensorFlow with GPU support? [y/n] n
No GPU support will be enabled for TensorFlow

Configuration finished
root@3b2b67124684:/tensorflow# bazel build -c opt --verbose_failures //tensorflow/cc:tutorials_example_trainer
INFO: Reading 'startup' options from /root/.bazelrc: --batch
INFO: Found 1 target...
INFO: From Compiling tensorflow/core/kernels/argmax_op.cc:
gcc: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.
ERROR: /tensorflow/tensorflow/core/BUILD:210:1: C++ compilation of rule '//tensorflow/core:kernels' failed: gcc failed: error executing command
  (cd /root/.cache/bazel/_bazel_root/68a62076e91007a7908bc42a32e4cff9/tensorflow && \
  exec env - \
    INTERCEPT_LOCALLY_EXECUTABLE=1 \
    PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
  /usr/bin/gcc -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -fPIE -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 -DNDEBUG -ffunction-sections -fdata-sections '-std=c++0x' -iquote . -iquote bazel-out/local_linux-opt/genfiles -isystem tools/cpp/gcc3 -isystem google/protobuf/src -isystem bazel-out/local_linux-opt/genfiles/google/protobuf/src -isystem external/jpeg_archive/jpeg-9a -isystem bazel-out/local_linux-opt/genfiles/external/jpeg_archive/jpeg-9a -isystem external/png_archive/libpng-1.2.53 -isystem bazel-out/local_linux-opt/genfiles/external/png_archive/libpng-1.2.53 -isystem external/re2 -isystem bazel-out/local_linux-opt/genfiles/external/re2 -isystem third_party/gpus/cuda -isystem bazel-out/local_linux-opt/genfiles/third_party/gpus/cuda -isystem third_party/gpus/cuda/include -isystem bazel-out/local_linux-opt/genfiles/third_party/gpus/cuda/include -isystem third_party/eigen3 -isystem bazel-out/local_linux-opt/genfiles/third_party/eigen3 -pthread -fno-exceptions -no-canonical-prefixes -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' '-frandom-seed=bazel-out/local_linux-opt/bin/tensorflow/core/_objs/kernels/tensorflow/core/kernels/argmax_op.o' -MD -MF bazel-out/local_linux-opt/bin/tensorflow/core/_objs/kernels/tensorflow/core/kernels/argmax_op.d -c tensorflow/core/kernels/argmax_op.cc -o bazel-out/local_linux-opt/bin/tensorflow/core/_objs/kernels/tensorflow/core/kernels/argmax_op.o): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 4: gcc failed: error executing command
  (cd /root/.cache/bazel/_bazel_root/68a62076e91007a7908bc42a32e4cff9/tensorflow && \
  exec env - \
    INTERCEPT_LOCALLY_EXECUTABLE=1 \
    PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
  /usr/bin/gcc -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -fPIE -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 -DNDEBUG -ffunction-sections -fdata-sections '-std=c++0x' -iquote . -iquote bazel-out/local_linux-opt/genfiles -isystem tools/cpp/gcc3 -isystem google/protobuf/src -isystem bazel-out/local_linux-opt/genfiles/google/protobuf/src -isystem external/jpeg_archive/jpeg-9a -isystem bazel-out/local_linux-opt/genfiles/external/jpeg_archive/jpeg-9a -isystem external/png_archive/libpng-1.2.53 -isystem bazel-out/local_linux-opt/genfiles/external/png_archive/libpng-1.2.53 -isystem external/re2 -isystem bazel-out/local_linux-opt/genfiles/external/re2 -isystem third_party/gpus/cuda -isystem bazel-out/local_linux-opt/genfiles/third_party/gpus/cuda -isystem third_party/gpus/cuda/include -isystem bazel-out/local_linux-opt/genfiles/third_party/gpus/cuda/include -isystem third_party/eigen3 -isystem bazel-out/local_linux-opt/genfiles/third_party/eigen3 -pthread -fno-exceptions -no-canonical-prefixes -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' '-frandom-seed=bazel-out/local_linux-opt/bin/tensorflow/core/_objs/kernels/tensorflow/core/kernels/argmax_op.o' -MD -MF bazel-out/local_linux-opt/bin/tensorflow/core/_objs/kernels/tensorflow/core/kernels/argmax_op.d -c tensorflow/core/kernels/argmax_op.cc -o bazel-out/local_linux-opt/bin/tensorflow/core/_objs/kernels/tensorflow/core/kernels/argmax_op.o): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 4.
Target //tensorflow/cc:tutorials_example_trainer failed to build
INFO: Elapsed time: 479.706s, Critical Path: 468.38s
4

1 回答 1

0

我在退出代码 4 上遇到了类似的问题(我认为这是内存不足)。

我的解决方案是增加 docker-machine 以使用 8GB。就像是:

docker-machine create --driver virtualbox --virtualbox-memory 8192 --virtualbox-cpu-count 4 default

于 2015-12-24T21:20:33.453 回答