Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从具有不同于系统GCC的源构建TensorFlow时包含错误_Tensorflow_Gcc_Bazel - Fatal编程技术网

从具有不同于系统GCC的源构建TensorFlow时包含错误

从具有不同于系统GCC的源构建TensorFlow时包含错误,tensorflow,gcc,bazel,Tensorflow,Gcc,Bazel,我一直在尝试从Red Hat Linux Enterprise edition集群的主分支构建TensorFlow 2.0 可用的默认GCC是4.8.5,不可能使用它编译TensorFlow,因为它使用显式 std=c++14 GCC 4.8.5中不可用的标志 因此,我开始使用modulefile使用gcc/8.3.0,其配置如下: (tensorflow2.0-master) -bash-4.2$ module show gcc/8.3.0/gcc-4.8.5 ---------------

我一直在尝试从Red Hat Linux Enterprise edition集群的主分支构建TensorFlow 2.0

可用的默认GCC是4.8.5,不可能使用它编译TensorFlow,因为它使用显式

std=c++14
GCC 4.8.5中不可用的标志

因此,我开始使用modulefile使用gcc/8.3.0,其配置如下:

(tensorflow2.0-master) -bash-4.2$ module show gcc/8.3.0/gcc-4.8.5
-------------------------------------------------------------------
/gpfslocalsup/pub/modules-idris/modulefiles/linux-rhel7-x86_64/gcc/8.3.0/gcc-4.8.5:


module-whatis The GNU Compiler Collection includes front ends for C, C++, Objective-C, Fortran, Ada, and Go, as well as libraries for these languages.
conflict gcc
prepend-path PATH /gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin
prepend-path MANPATH /gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/share/man
prepend-path LD_LIBRARY_PATH /gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/lib
prepend-path LIBRARY_PATH /gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/lib
prepend-path LD_LIBRARY_PATH /gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/lib64
prepend-path LIBRARY_PATH /gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/lib64
prepend-path CPATH /gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/include
prepend-path CMAKE_PREFIX_PATH /gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/
setenv CC /gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/gcc
setenv CXX /gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/g++
setenv FC /gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/gfortran
setenv F77 /gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/gfortran
setenv F90 /gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/gfortran
-------------------------------------------------------------------
为了编译TensorFlow,我首先编译了bazel-0.29.1,为此我修改了
tools/cpp/cc_toolchain_config.bzl

文件如下:

(tensorflow2.0-master) -bash-4.2$ module show gcc/8.3.0/gcc-4.8.5
-------------------------------------------------------------------
/gpfslocalsup/pub/modules-idris/modulefiles/linux-rhel7-x86_64/gcc/8.3.0/gcc-4.8.5:


module-whatis The GNU Compiler Collection includes front ends for C, C++, Objective-C, Fortran, Ada, and Go, as well as libraries for these languages.
conflict gcc
prepend-path PATH /gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin
prepend-path MANPATH /gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/share/man
prepend-path LD_LIBRARY_PATH /gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/lib
prepend-path LIBRARY_PATH /gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/lib
prepend-path LD_LIBRARY_PATH /gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/lib64
prepend-path LIBRARY_PATH /gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/lib64
prepend-path CPATH /gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/include
prepend-path CMAKE_PREFIX_PATH /gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/
setenv CC /gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/gcc
setenv CXX /gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/g++
setenv FC /gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/gfortran
setenv F77 /gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/gfortran
setenv F90 /gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/gfortran
-------------------------------------------------------------------
我用上述路径中的二进制文件替换了
/usr/bin/gcc
/usr/bin/gcov
/usr/bin/nm
/usr/bin/ar
/usr/bin/cpp
的所有组件。 我将如上所示的include路径添加到文件中存在的
cxx\u builtin\u include\u目录的列表中

之后,我开始构建TensorFlow

使用的命令是:

CC=/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/gcc bazel --output_user_root=/tmp/ujjwal-builds build --config=opt --config=cuda --config=mkl --config=numa //tensorflow/tools/pip_package:build_pip_package --verbose_failures
这最终给了我以下错误:

INFO: Analyzed target //tensorflow/tools/pip_package:build_pip_package (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: /tmp/ujjwal-builds/7d993f307acf01aa765c32a6dcabd368/external/gif/BUILD.bazel:8:1: undeclared inclusion(s) in rule '@gif//:gif':
this rule is missing dependency declarations for the following files included by 'external/gif/gif_err.c':
  '/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include/stddef.h'
  '/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include/stdarg.h'
  '/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include/stdbool.h'
  '/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include/stdint.h'
Target //tensorflow/tools/pip_package:build_pip_package failed to build
INFO: Elapsed time: 2.152s, Critical Path: 1.63s
INFO: 7 processes: 7 local.
FAILED: Build did NOT complete successfully
我曾尝试在网上搜索解决方案,但没有令人满意的解决方案。谁能帮我处理一下这里发生的事情,因为这对我很重要

如果有帮助的话,我已经在下面附上了gcc和g++include路径的输出:

gcc -E -xc++ - -v
Reading specs from /gpfs7kro/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/../lib/gcc/x86_64-pc-linux-gnu/8.3.0/specs
COLLECT_GCC=gcc
Target: x86_64-pc-linux-gnu
Configured with: /gpfs7kw/linkhome/idris/softmgr/softmgr01/spack/var/spack/stage/gcc-8.3.0-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/spack-src/configure --prefix=/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3 --disable-multilib --enable-languages=c,c++,fortran --with-mpfr=/gpfslocalsup/spack_soft/mpfr/3.1.6/gcc-4.8.5-vwx7snyrzymeg5n6f7dg5tbpgk35do3k --with-gmp=/gpfslocalsup/spack_soft/gmp/6.1.2/gcc-4.8.5-5odxtlxihbfjtj4dxo52oz5f7r6ir6jk --enable-lto --with-quad --with-system-zlib --with-mpc=/gpfslocalsup/spack_soft/mpc/1.1.0/gcc-4.8.5-pogagquauxex67doa7v2mkas2gcs5xut --with-isl=/gpfslocalsup/spack_soft/isl/0.18/gcc-4.8.5-3wslknueis6r2nx3tasaizgda2ianxfa
Thread model: posix
gcc version 8.3.0 (GCC)
COLLECT_GCC_OPTIONS='-E' '-v' '-mtune=generic' '-march=x86-64'
 /gpfs7kro/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/../libexec/gcc/x86_64-pc-linux-gnu/8.3.0/cc1plus -E -quiet -v -iprefix /gpfs7kro/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/../lib/gcc/x86_64-pc-linux-gnu/8.3.0/ -D_GNU_SOURCE - -mtune=generic -march=x86-64
ignoring nonexistent directory "/gpfs7kro/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/../lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/include"
ignoring duplicate directory "/gpfs7kro/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/../lib/gcc/../../lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../include/c++/8.3.0"
ignoring duplicate directory "/gpfs7kro/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/../lib/gcc/../../lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../include/c++/8.3.0/x86_64-pc-linux-gnu"
ignoring duplicate directory "/gpfs7kro/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/../lib/gcc/../../lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../include/c++/8.3.0/backward"
ignoring duplicate directory "/gpfs7kro/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/../lib/gcc/../../lib/gcc/x86_64-pc-linux-gnu/8.3.0/include"
ignoring duplicate directory "/gpfs7kro/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/../lib/gcc/../../lib/gcc/x86_64-pc-linux-gnu/8.3.0/include-fixed"
ignoring nonexistent directory "/gpfs7kro/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/../lib/gcc/../../lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/include"
ignoring duplicate directory "/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/include"
  as it is a non-system directory that duplicates a system directory
#include "..." search starts here:
#include <...> search starts here:
 /gpfslocalsys/intel/parallel_studio_xe_2019_update5_cluster_edition/compilers_and_libraries_2019.5.281/linux/mkl/include
 /gpfs7kro/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/../lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../include/c++/8.3.0
 /gpfs7kro/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/../lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../include/c++/8.3.0/x86_64-pc-linux-gnu
 /gpfs7kro/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/../lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../include/c++/8.3.0/backward
 /gpfs7kro/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/../lib/gcc/x86_64-pc-linux-gnu/8.3.0/include
 /gpfs7kro/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/../lib/gcc/x86_64-pc-linux-gnu/8.3.0/include-fixed
 /usr/local/include
 /gpfs7kro/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/../lib/gcc/../../include
 /usr/include
End of search list.
gcc-E-xc++-v
从/gpfs7kro/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/。/lib/gcc/x86_64-pc-linux-gnu/8.3.0/specs读取规范
收集\u GCC=GCC
目标:x86_64-pc-linux-gnu
gpfs7kW/sFastMg01/SPACK/VAR/SPACK/STO/GCC-83.0OPWTWDJ2HXO4LJVNX77 UGB6AFMVJ3/SPACK-SRC/配置-前缀=/GPFSLULATUPS/SPACKYSUB/GCC/83.0/GCC-4.85-OPNWTTDJ2GH2O4LJVNX77 UGB6AFMVJ3——禁用多个LIB语言,C语言,C++语言,配置为:fortran——带mpfr=/gpfslocalsup/spack_soft/mpfr/3.1.6/gcc-4.8.5-vwx7snyrzymeg5n6f7dg5tbpgk35do3k——带gmp=/gpfslocalsup/spack_soft/gmp/6.1.2/gcc-4.8.5-5odxtlxihbfjtj4dxo52oz5f7r6ir6jk——启用lto——带四元——带系统zlib——带mpc=/gpfslocalsup/spack_soft/mpc/mpc/1.1.0/1.0/gcc-DOAQUAG772G8G8GPCS7J7K--使用isl=/gpfslocalsup/spack_soft/isl/0.18/gcc-4.8.5-3wslknueis6r2nx3tasaizgda2ianxfa
线程模型:posix
gcc版本8.3.0(gcc)
COLLECT\u GCC\u OPTIONS='-E'-v'-mtune=generic'-march=x86-64'
/7.5-5-5-5-5-5-5-5-5-5-5-5-5-5-5-5-5-5-5-7-7-7-7-7-7-7-7-7-7-7-7-7-7-7-7-7-7-7-7-7-7-7-7-7-7-7-7-7-7-7-GGGGGvvvvvvvv7 7-7-7-7-7-GGGGGGGGG7 7 7 7 7 7 7 7 7-7 7-6 6 6 6/6 6/6/7 7 7 7 7 7 7/6/6/6/7 7 7 7 7/6/7 7 7/7/6/6/6/7 7 7/6/6/6/6/6/6/6/6/6/6/6/6/6/6/6/6/6/6/6/6/6/6/6 mtune=generic-march=x86-64
忽略不存在的目录“/gpfs7kro/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/。/lib/gcc/x86_64-pc-linux-gnu/8.3.0/。/../../../../../x86_64-pc-linux-gnu/include”
忽略重复目录“/gpfs7kro/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/./lib/gcc/../lib/gcc/x86_64-pc-linux-gnu/8.3.0/../include/c++/8.3.0”
忽略重复目录“/gpfs7kro/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/./lib/gcc/../../lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../../include/c++/8.3.0/x86_64-pc-linux-gnu”
忽略重复目录“/gpfs7kro/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/./lib/gcc/../../lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../../include/c++/8.3.0/backward
忽略重复目录“/gpfs7kro/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/./lib/gcc/../lib/gcc/x86_64-pc-linux-gnu/8.3.0/include”
忽略重复目录“/gpfs7kro/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/./lib/gcc/../lib/gcc/x86_64-pc-linux-gnu/8.3.0/include fixed”
忽略不存在的目录“/gpfs7kro/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin//lib/gcc/../../lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/include”
忽略重复目录“/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/include”
因为它是与系统目录重复的非系统目录
#包括“…”搜索从这里开始:
#包括搜索从这里开始:
/gpfslocalsys/intel/parallel_studio_xe_2019_update5_cluster_edition/compilers_and_libraries_2019.5.281/linux/mkl/include
/gpfs7kro/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/。/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../../include/c++/8.3.0
/gpfs7kro/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/。/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../../include/c++/8.3.0/x86_64-pc-linux-gnu
/gpfs7kro/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/。/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../../include/c++/8.3.0/backward
/gpfs7kro/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/。/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include
/gpfs7kro/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/。/lib/gcc/x86_64-pc-linux-gnu/8.3.0/include-fixed
/usr/本地/包括
/gpfs7kro/gpfslocalsup/spack_soft/gcc/8.3.0/gcc-4.8.5-opnwtdjumg2hxo4ljvnx77ugb6afmvj3/bin/。/../lib/gcc/../include
/usr/包括
搜索列表结束。

您可以尝试在spack中使用此PR:https://github.com/spack/spack/pull/14681

您使用gcc-8.3.0有什么原因吗?Tensorflow 2.0是用
gcc-7.3.1
编译的,这是因为gcc 7.3.1在集群上不可用。此外,我也尝试过使用英特尔编译器,每次我都会遇到这样的include错误。所以,我相信问题出在配置的某个地方。