【问题标题】:GCC compilation error while building tensorflow using docker on mac(host) running ubuntu在运行 ubuntu 的 mac(host) 上使用 docker 构建 tensorflow 时出现 GCC 编译错误
【发布时间】:2020-06-02 06:34:02
【问题描述】:

系统信息

  • 操作系统平台:主机:mac 14.10
  • docker 镜像:tensorflow/tensorflow:latest-devel
  • TensorFlow 版本:2.2
  • Python 版本:3.6.9
  • 在 Mac 上使用 docker 和 docker 映像中的 ubuntu 从源代码构建 tensorflow
  • Bazel 版本(如果从源代码编译):3.0.0
  • GCC/编译器版本(如果从源代码编译):
  • CUDA/cuDNN 版本:无(仅 cpu 构建)
  • GPU 型号和内存:无

问题

ERROR: /tensorflow_src/tensorflow/core/BUILD:2193:1: C++ compilation of rule '//tensorflow/core:framework_internal_impl' failed (Exit 4): gcc failed: error executing command 
  (cd /root/.cache/bazel/_bazel_root/43801f1e35f242fb634ebbc6079cf6c5/execroot/org_tensorflow && \
  exec env - \
    PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
    PWD=/proc/self/cwd \

  /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections -fdata-sections '-std=c++0x' -MD -MF bazel-out/k8-opt-exec-50AE0418/bin/tensorflow/core/_objs/framework_internal_impl/batch_util.pic.d '-frandom-seed=bazel-out/k8-opt-exec-50AE0418/bin/tensorflow/core/_objs/framework_internal_impl/batch_util.pic.o' -fPIC -DEIGEN_MPL2_ONLY '-DEIGEN_MAX_ALIGN_BYTES=64' '-DEIGEN_HAS_TYPE_TRAITS=0' -DHAVE_SYS_UIO_H -DTF_USE_SNAPPY -D__CLANG_SUPPORT_DYN_ANNOTATION__ -iquote . -iquote bazel-out/k8-opt-exec-50AE0418/bin -iquote external/com_google_protobuf -iquote bazel-out/k8-opt-exec-50AE0418/bin/external/com_google_protobuf -iquote external/com_google_absl -iquote bazel-out/k8-opt-exec-50AE0418/bin/external/com_google_absl -iquote external/nsync -iquote bazel-out/k8-opt-exec-50AE0418/bin/external/nsync -iquote external/eigen_archive -iquote bazel-out/k8-opt-exec-50AE0418/bin/external/eigen_archive -iquote external/local_config_sycl -iquote bazel-out/k8-opt-exec-50AE0418/bin/external/local_config_sycl -iquote external/gif -iquote bazel-out/k8-opt-exec-50AE0418/bin/external/gif -iquote external/libjpeg_turbo -iquote bazel-out/k8-opt-exec-50AE0418/bin/external/libjpeg_turbo -iquote external/com_googlesource_code_re2 -iquote bazel-out/k8-opt-exec-50AE0418/bin/external/com_googlesource_code_re2 -iquote external/farmhash_archive -iquote bazel-out/k8-opt-exec-50AE0418/bin/external/farmhash_archive -iquote external/fft2d -iquote bazel-out/k8-opt-exec-50AE0418/bin/external/fft2d -iquote external/highwayhash -iquote bazel-out/k8-opt-exec-50AE0418/bin/external/highwayhash -iquote external/zlib -iquote bazel-out/k8-opt-exec-50AE0418/bin/external/zlib -iquote external/double_conversion -iquote bazel-out/k8-opt-exec-50AE0418/bin/external/double_conversion -iquote external/snappy -iquote bazel-out/k8-opt-exec-50AE0418/bin/external/snappy -isystem external/com_google_protobuf/src -isystem bazel-out/k8-opt-exec-50AE0418/bin/external/com_google_protobuf/src -isystem external/nsync/public -isystem bazel-out/k8-opt-exec-50AE0418/bin/external/nsync/public -isystem external/eigen_archive -isystem bazel-out/k8-opt-exec-50AE0418/bin/external/eigen_archive -isystem external/gif -isystem bazel-out/k8-opt-exec-50AE0418/bin/external/gif -isystem external/farmhash_archive/src -isystem bazel-out/k8-opt-exec-50AE0418/bin/external/farmhash_archive/src -isystem external/zlib -isystem bazel-out/k8-opt-exec-50AE0418/bin/external/zlib -isystem external/double_conversion -isystem bazel-out/k8-opt-exec-50AE0418/bin/external/double_conversion -g0 '-march=native' -g0 '-std=c++14' -DEIGEN_AVOID_STL_ARRAY -Iexternal/gemmlowp -Wno-sign-compare '-ftemplate-depth=900' -fno-exceptions '-DTENSORFLOW_USE_XLA=1' -msse3 -pthread '-DTENSORFLOW_USE_XLA=1' -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c tensorflow/core/util/batch_util.cc -o bazel-out/k8-opt-exec-50AE0418/bin/tensorflow/core/_objs/framework_internal_impl/batch_util.pic.o)
Execution platform: @local_execution_config_platform//:platform
In file included from ./third_party/eigen3/unsupported/Eigen/CXX11/FixedPoint:41:0,
                 from ./tensorflow/core/framework/numeric_types.h:24,
                 from ./tensorflow/core/framework/allocator.h:26,
                 from ./tensorflow/core/framework/tensor.h:23,
                 from ./tensorflow/core/util/batch_util.h:18,
                 from tensorflow/core/util/batch_util.cc:16:

./third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/PacketMathAVX2.h:30:41: warning: ignoring attributes on template argument '__m256i {aka __vector(4) long long int}' [-Wignored-attributes]
 typedef eigen_packet_wrapper<__m256i, 20> Packet32q8i;
                                         ^
./third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/PacketMathAVX2.h:31:41: warning: ignoring attributes on template argument '__m256i {aka __vector(4) long long int}' [-Wignored-attributes]
 typedef eigen_packet_wrapper<__m256i, 21> Packet16q16i;
                                         ^
./third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/PacketMathAVX2.h:32:41: warning: ignoring attributes on template argument '__m256i {aka __vector(4) long long int}' [-Wignored-attributes]
 typedef eigen_packet_wrapper<__m256i, 22> Packet32q8u;
                                         ^
./third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/PacketMathAVX2.h:33:41: warning: ignoring attributes on template argument '__m128i {aka __vector(2) long long int}' [-Wignored-attributes]
 typedef eigen_packet_wrapper<__m128i, 23> Packet16q8i;
                                         ^
./third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/PacketMathAVX2.h:34:41: warning: ignoring attributes on template argument '__m128i {aka __vector(2) long long int}' [-Wignored-attributes]
 typedef eigen_packet_wrapper<__m128i, 25> Packet16q8u;
                                         ^
./third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/PacketMathAVX2.h:35:41: warning: ignoring attributes on template argument '__m128i {aka __vector(2) long long int}' [-Wignored-attributes]
 typedef eigen_packet_wrapper<__m128i, 26> Packet8q16i;
                                         ^
./third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/PacketMathAVX2.h:36:41: warning: ignoring attributes on template argument '__m256i {aka __vector(4) long long int}' [-Wignored-attributes]
 typedef eigen_packet_wrapper<__m256i, 27> Packet8q32i;
                                         ^
./third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/PacketMathAVX2.h:37:41: warning: ignoring attributes on template argument '__m128i {aka __vector(2) long long int}' [-Wignored-attributes]
 typedef eigen_packet_wrapper<__m128i, 28> Packet4q32i;
                                         ^
gcc: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions.
Target //tensorflow/tools/pip_package:build_pip_package failed to build
INFO: Elapsed time: 1314.325s, Critical Path: 521.70s
INFO: 469 processes: 469 local.
FAILED: Build did NOT complete successfully
  • 我正在尝试从源代码构建 tensorflow 以启用 AVX 和 FMA 指令。我按照确切的说明开始构建。正如给定的here 一样,我正在构建仅限 cpu 的版本。
  • 由于我是从最新版本构建的,我应该从 master 分支构建。所以我开始使用以下命令:

bazel build --config=opt --local_ram_resources=4096 --verbose_failures //tensorflow/tools/pip_package:build_pip_packag

  • 此后分析阶段完成。编译期间发生错误。

无法诊断错误。请帮忙

【问题讨论】:

    标签: python docker gcc tensorflow2.0


    【解决方案1】:

    留言./third_party/eigen3/unsupported/Eigen/CXX11/src/FixedPoint/PacketMathAVX2.h:37:41: warning: ignoring attributes on template argument '__m128i {aka __vector(2) long long int}' [-Wignored-attributes] typedef eigen_packet_wrapper<__m128i, 28> Packet4q32i;

    不是严重错误,不会阻止成功构建。如果使用 gcc 5 或更高版本,请按照此处https://www.tensorflow.org/install/source 的描述包含标志--cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0"

    gcc 内部编译器错误可能会用这个标志解决。

    此外,local_ram_resources 可能还不够,您可以使用--local_resources x,y.0,1.0,其中 x 是要使用的内存数量,y 是要使用的 cpu 核心数。这将防止构建在编译期间使用过多的 ram 和冻结。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-09
      • 1970-01-01
      • 2012-01-07
      • 2016-09-03
      • 2016-11-20
      • 2019-06-02
      相关资源
      最近更新 更多