Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sql-server-2005/2.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
tensorflow生成失败,返回“0”;“缺少依赖关系”;错误_Tensorflow_Bazel - Fatal编程技术网

tensorflow生成失败,返回“0”;“缺少依赖关系”;错误

tensorflow生成失败,返回“0”;“缺少依赖关系”;错误,tensorflow,bazel,Tensorflow,Bazel,我对bazel和tensorflow完全不熟悉,所以对一些有经验的人来说,解决这个问题的方法可能是显而易见的。tensorflow的bazel构建失败,并显示“缺少依赖项”错误消息。以下是构建命令和输出的相关顺序: (tf-gpu)kss@linux-9c32:~/projects> git clone --recurse-submodules https://github.com/tensorflow/tensorflow tensorflow-nogpu Cloning into 't

我对bazel和tensorflow完全不熟悉,所以对一些有经验的人来说,解决这个问题的方法可能是显而易见的。tensorflow的bazel构建失败,并显示“缺少依赖项”错误消息。以下是构建命令和输出的相关顺序:

(tf-gpu)kss@linux-9c32:~/projects> git clone --recurse-submodules https://github.com/tensorflow/tensorflow tensorflow-nogpu
Cloning into 'tensorflow-nogpu'...
remote: Counting objects: 16735, done.
remote: Compressing objects: 100% (152/152), done.
remote: Total 16735 (delta 73), reused 0 (delta 0), pack-reused 16583
Receiving objects: 100% (16735/16735), 25.25 MiB | 911.00 KiB/s, done.
Resolving deltas: 100% (10889/10889), done.
Checking connectivity... done.
Submodule 'google/protobuf' (https://github.com/google/protobuf.git) registered for path 'google/protobuf'
Cloning into 'google/protobuf'...
remote: Counting objects: 30266, done.
remote: Compressing objects: 100% (113/113), done.
remote: Total 30266 (delta 57), reused 0 (delta 0), pack-reused 30151
Receiving objects: 100% (30266/30266), 28.90 MiB | 1.98 MiB/s, done.
Resolving deltas: 100% (20225/20225), done.
Checking connectivity... done.
Submodule path 'google/protobuf': checked out '0906f5d18a2548024b511eadcbb4cfc0ca56cd67'
(tf-gpu)kss@linux-9c32:~/projects> cd tensorflow-nogpu/
(tf-gpu)kss@linux-9c32:~/projects/tensorflow-nogpu> ./configure 
Please specify the location of python. [Default is /home/kss/.venv/tf-gpu/bin/python]: 
Do you wish to build TensorFlow with GPU support? [y/N] 
No GPU support will be enabled for TensorFlow
Configuration finished
(tf-gpu)kss@linux-9c32:~/projects/tensorflow-nogpu> bazel build -c opt //tensorflow/tools/pip_package:build_pip_package                                                        
Sending SIGTERM to previous Bazel server (pid=8491)... done.
....
INFO: Found 1 target...
ERROR: /home/kss/.cache/bazel/_bazel_kss/b97e0e942a10977a6b42467ea6712cbf/external/re2/BUILD:9:1: undeclared inclusion(s) in rule '@re2//:re2':
this rule is missing dependency declarations for the following files included by 'external/re2/re2/perl_groups.cc':
  '/usr/lib64/gcc/x86_64-suse-linux/4.8/include/stddef.h'
  '/usr/lib64/gcc/x86_64-suse-linux/4.8/include/stdarg.h'
  '/usr/lib64/gcc/x86_64-suse-linux/4.8/include/stdint.h'
  '/usr/lib64/gcc/x86_64-suse-linux/4.8/include/x86intrin.h'
  '/usr/lib64/gcc/x86_64-suse-linux/4.8/include/ia32intrin.h'
  '/usr/lib64/gcc/x86_64-suse-linux/4.8/include/mmintrin.h'
  '/usr/lib64/gcc/x86_64-suse-linux/4.8/include/xmmintrin.h'
  '/usr/lib64/gcc/x86_64-suse-linux/4.8/include/mm_malloc.h'
  '/usr/lib64/gcc/x86_64-suse-linux/4.8/include/emmintrin.h'
  '/usr/lib64/gcc/x86_64-suse-linux/4.8/include/immintrin.h'
  '/usr/lib64/gcc/x86_64-suse-linux/4.8/include/fxsrintrin.h'
  '/usr/lib64/gcc/x86_64-suse-linux/4.8/include/adxintrin.h'.
Target //tensorflow/tools/pip_package:build_pip_package failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 144.661s, Critical Path: 1.18s
(tf-gpu)kss@linux-9c32:~/projects/tensorflow-nogpu> 
我使用的bazel版本是0.1.4版,我在openSUSE 13.2上运行。我确认头文件确实存在,这可能是预期的:

(tf-gpu)kss@linux-9c32:~/projects/tensorflow-nogpu> ll /usr/lib64/gcc/x86_64-suse-linux/4.8/include/stddef.h
-rw-r--r-- 1 root root 13619 Oct  6  2014 /usr/lib64/gcc/x86_64-suse-linux/4.8/include/stddef.h

请注意发现此问题的所有人

使用下面Damien的答案,但您必须使用
--crosstool\u top
而不是
--crosstool
。此外,如果您正在构建GPU加速,您还需要修改tensorflow repo中的
CROSSTOOL
文件,如:

(tf-gpu)kss@linux-9c32:~/projects/tensorflow-gpu> git diff third_party/gpus/crosstool/CROSSTOOL | cat
diff --git a/third_party/gpus/crosstool/CROSSTOOL b/third_party/gpus/crosstool/CROSSTOOL
index dfde7cd..b63f950 100644
--- a/third_party/gpus/crosstool/CROSSTOOL
+++ b/third_party/gpus/crosstool/CROSSTOOL
@@ -56,6 +56,7 @@ toolchain {
   cxx_builtin_include_directory: "/usr/lib/gcc/"
   cxx_builtin_include_directory: "/usr/local/include"
   cxx_builtin_include_directory: "/usr/include"
+  cxx_builtin_include_directory: "/usr/lib64/gcc"
   tool_path { name: "gcov" path: "/usr/bin/gcov" }

   # C(++) compiles invoke the compiler (as that is the one knowing where

你应该调整C++编译器。< /P> 要做到这一点,以下是最好的方法: 编辑程序包路径目录中的文件

tools/cpp/CROSSTOOL
(应位于
~/.bazel/base_工作区
,可在
bazel info package_path
中找到)以在第100行周围添加一行
cxx内置目录:/usr/lib64/gcc
(请参阅)

然后
echo“build--crosstool=//tools/cpp:toolchain”>>~/.bazelrc
然后重试构建


对不起,我们正在努力使C++工具链工作得更好。

系统头文件的BAZEL抱怨,因为编译器在生成依赖时使用-MD(反对MMD)标志。虽然对于经常更改的环境使用-MD是合理的,但在系统头文件上列出依赖项会导致“缺少依赖项声明”错误

帮助我的是将编译器包装文件第三方/gpu/crosstool/clang/bin/crosstool\u包装文件\u驱动程序\u在“subprocess.call([CPU\u编译器]…)之前将'-MD'标志转换为'-MMD'标志:

和第三方/sycl/crosstool/computecpp.tpl,类似位置:

computecpp_device_compiler_flags = ['-MMD' if flag == '-MD' else flag for flag in computecpp_device_compiler_flags]

(另一种方法是在CROSSTOOL文件中编译一个自定义版本的bazel),非常感谢您的帮助。我尝试了你建议的修改(在回答中而不是评论中),编译成功了。我必须对“交叉”命令做一个小的修改,而不是“生成”命令所没有的“交叉窗口”。这使我很难理解,但我仍然碰到了一个问题:“C++的规则编译”//TunSoFrase/Python:py-FoeSuffLIB失败:GCC失败:执行命令出错。有什么想法?@ TimsiMunt,这只是一个暗中的尝试,但是你安装了python开发库了吗?嗨,Keith,这是一个很好的例子。我发现我需要更新numpy以使其正常工作,但现在我仍然被另一个gcc问题所困扰。。我打开了门
computecpp_device_compiler_flags = ['-MMD' if flag == '-MD' else flag for flag in computecpp_device_compiler_flags]