在构建syntaxnet时,Bazel构建失败并显示“执行genrule @six_archive //:copy_six failed”错误

时间:2016-05-13 15:04:52

标签: tensorflow bazel syntaxnet

我正在尝试按照syntaxnet's github page中的说明构建语法网解析器模型。

我的系统是Debian Wheezy 。不应该与Ubuntu 14.04 LTS或15.05有很大不同。我从源代码编译了bazel 0.2.2(而不是0.2.2b),它似乎工作正常。

每当我启动bazel test syntaxnet/... util/utf8/...命令时,都不会执行任何测试(全部被跳过),并带有一些非常神秘的错误消息。这是一个例子:

root@host:~/tensorflow_syntaxnet/models/syntaxnet# ../../bazel/output/bazel test syntaxnet/... util/utf8/...
Extracting Bazel installation...
.............
INFO: Found 65 targets and 12 test targets...
ERROR: /root/.cache/bazel/_bazel_root/74c6bab7a21f28ad02405b720243d086/external/six_archive/BUILD:1:1: Executing genrule @six_archive//:copy_six failed: namespace-sandbox failed: error executing command /root/.cache/bazel/_bazel_root/74c6bab7a21f28ad02405b720243d086/syntaxnet/_bin/namespace-sandbox ... (remaining 5 argument(s) skipped).
unshare failed with EINVAL even after 101 tries, giving up.
INFO: Elapsed time: 95.469s, Critical Path: 22.46s
//syntaxnet:arc_standard_transitions_test                             NO STATUS
//syntaxnet:beam_reader_ops_test                                      NO STATUS
//syntaxnet:graph_builder_test                                        NO STATUS
//syntaxnet:lexicon_builder_test                                      NO STATUS
//syntaxnet:parser_features_test                                      NO STATUS
//syntaxnet:parser_trainer_test                                       NO STATUS
//syntaxnet:reader_ops_test                                           NO STATUS
//syntaxnet:sentence_features_test                                    NO STATUS
//syntaxnet:shared_store_test                                         NO STATUS
//syntaxnet:tagger_transitions_test                                   NO STATUS
//syntaxnet:text_formats_test                                         NO STATUS
//util/utf8:unicodetext_unittest                                      NO STATUS

Executed 0 out of 12 tests: 12 were skipped.

我正在推荐使用Oracle Java 8 JDK,我的编译器是:

~/tensorflow_syntaxnet/models/syntaxnet# gcc --version
gcc (Debian 4.7.2-5) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

尝试查看错误消息中提到的namespace-sandbox二进制文件,但在深入研究之前,我想我会问这里。

~/tensorflow_syntaxnet/models/syntaxnet# ls -l /root/.cache/bazel/_bazel_root/74c6bab7a21f28ad02405b720243d086/syntaxnet/_bin/namespace-sandbox
lrwxrwxrwx 1 root root 108 May 13 14:52 /root/.cache/bazel/_bazel_root/74c6bab7a21f28ad02405b720243d086/syntaxnet/_bin/namespace-sandbox -> /root/.cache/bazel/_bazel_root/install/ca381eaad1c931167a6355cb8a2b98cf/_embedded_binaries/namespace-sandbox
~/tensorflow_syntaxnet/models/syntaxnet# readlink /root/.cache/bazel/_bazel_root/74c6bab7a21f28ad02405b720243d086/syntaxnet/_bin/namespace-sandbox
/root/.cache/bazel/_bazel_root/install/ca381eaad1c931167a6355cb8a2b98cf/_embedded_binaries/namespace-sandbox

命令似乎工作正常:

~/tensorflow_syntaxnet/models/syntaxnet# file $(readlink /root/.cache/bazel/_bazel_root/74c6bab7a21f28ad02405b720243d086/syntaxnet/_bin/namespace-sandbox)
/root/.cache/bazel/_bazel_root/install/ca381eaad1c931167a6355cb8a2b98cf/_embedded_binaries/namespace-sandbox: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.26, BuildID[md5/uuid]=0xecfd97b6a6b9a193b045be13654bd55b, not stripped
~/tensorflow_syntaxnet/models/syntaxnet# /root/.cache/bazel/_bazel_root/install/ca381eaad1c931167a6355cb8a2b98cf/_embedded_binaries/namespace-sandbox
No command specified.
Usage: /root/.cache/bazel/_bazel_root/install/ca381eaad1c931167a6355cb8a2b98cf/_embedded_binaries/namespace-sandbox [-S sandbox-root] -- command arg1
  provided: /root/.cache/bazel/_bazel_root/install/ca381eaad1c931167a6355cb8a2b98cf/_embedded_binaries/namespace-sandbox
Mandatory arguments:
  -S <sandbox-root>  directory which will become the root of the sandbox
  --  command to run inside sandbox, followed by arguments

Optional arguments:
  -W <working-dir>  working directory
  -T <timeout>  timeout after which the child process will be terminated with SIGTERM
  -t <timeout>  in case timeout occurs, how long to wait before killing the child with SIGKILL
  -d <dir>  create an empty directory in the sandbox
  -M/-m <source/target>  system directory to mount inside the sandbox
    Multiple directories can be specified and each of them will be mounted readonly.
    The -M option specifies which directory to mount, the -m option specifies where to
    mount it in the sandbox.
  -n if set, a new network namespace will be created
  -r if set, make the uid/gid be root, otherwise use nobody
  -D  if set, debug info will be printed
  -l <file>  redirect stdout to a file
  -L <file>  redirect stderr to a file
  @FILE read newline-separated arguments from FILE

有什么想法吗?

更新:我在Ubuntu 14.04 LTS(我的小型工作站,而不是运行Debian的生产服务器)上完成了相同的步骤,一切运行良好,所有测试都通过了。我想知道有什么区别。

1 个答案:

答案 0 :(得分:1)

显然,在设置沙箱时会发生一些权限错误。快速解决方法是使用--genrule_strategy=standalone --spawn_strategy=standalone停用沙箱(请注意,第二个已在TensorFlow rc文件中指定)。

您可以在〜/ .bazelrc中设置这些标志: echo "build --genrule_strategy=standalone --spawn_strategy=standalone" >>~/.bazelrc