Skip to content

Executing genrule //syntaxnet:parser_ops_pygenrule failed (Exit 255): bash failed: error executing command #4085

@SaintNazaire

Description

@SaintNazaire

OS Platform and Distribution

  • Windows 10 professional
  • Docker image based on Ubuntu:16.04.4 LTS (xenial)
  • Docker 18.03.0-ce-win59
  • Python versions 2.7.12 & 3.5.2
  • CUDA/cuDNN version not relevant (CPU install)
  • GPU model and memory not relevant (CPU install)

TensorFlow installed from

  • Github /tensorflow/tensorflow branch:master

TensorFlow version

Tensorflow 1.8

Bazel version

Bazel 0.12.0

Exact command to reproduce

cd /models/research/syntaxnet && bazel build ... --subcommands --explain=/tmp/bazel_build_log.txt --verbose_explanations=True --verbose_failures

What is the top-level directory of the model you are using

/models/research/syntaxnet

Have I written custom code (as opposed to using a stock example script provided in TensorFlow)

Spent past three months migrating step by step Syntaxnet towards Bazel and Tensorflow current releases instead of Bazel 0.5.4 and Tensorflow 1.3.

  • Bazel 0.12.0 (initially 0.9.0)
  • Tensorflow r1.8 (intially r1.6)

Describe the problem

After clearing a lot of obstacles I reach the far end of the build (>7000) process with much warning but no error up to executing genrules related to "tf_gen_op_wrapper_py". The example of log I have provided below relates to //syntaxnet:parser_ops_pygenrule but I get the same error with //dragnn/core:dragnn_ops_pygenrule or //dragnn/core:dragnn_bulk_ops_pygenrule which also throw 255 exception errors.

In BUILD this "tf_gen_op_wrapper_py" looks like for example:

tf_gen_op_wrapper_py(
    name = "dragnn_bulk_ops",
    deps = [":dragnn_bulk_ops_op_lib"],
)

For //syntaxnet: it is located in /models/research/syntaxnet/syntaxnet/syntaxnet.bzl and for //dragnn/core: it is located in /models/research/syntaxnet/dragnn/tensorflow_ops.bzl

Code for tf_gen_op_wrapper_py as follows:

def tf_gen_op_wrapper_py(name, out=None, hidden=None, visibility=None, deps=[],
                         require_shape_functions=False, hidden_file=None,
                         generated_target_name=None):
  # Construct a cc_binary containing the specified ops.
  tool_name = "gen_" + name + "_py_wrappers_cc"
  if not deps:
    deps = ["@org_tensorflow//tensorflow/core:" + name + "_op_lib"]
  native.cc_binary(
      name = tool_name,
      linkopts = ["-lm"],
      copts = tf_copts(),
      linkstatic = 1,   # Faster to link this one-time-use binary dynamically
      deps = (["@org_tensorflow//tensorflow/core:framework",
               "@org_tensorflow//tensorflow/python:python_op_gen_main"] + deps),
      visibility = ["@org_tensorflow//tensorflow:internal"],
  )

  # Invoke the previous cc_binary to generate a python file.
  if not out:
    out = "ops/gen_" + name + ".py"

  if hidden:
    # `hidden` is a list of op names to be hidden in the generated module.
    native.genrule(
        name=name + "_pygenrule",
        outs=[out],
        tools=[tool_name],
        cmd=("$(location " + tool_name + ") " + ",".join(hidden)
             + " " + ("1" if require_shape_functions else "0") + " > $@"))
  elif hidden_file:
    # `hidden_file` is file containing a list of op names to be hidden in the
    # generated module.
    native.genrule(
        name=name + "_pygenrule",
        outs=[out],
        srcs=[hidden_file],
        tools=[tool_name],
        cmd=("$(location " + tool_name + ") @$(location "
             + hidden_file + ") " + ("1" if require_shape_functions else "0")
             + " > $@"))
  else:
    # No ops should be hidden in the generated module.
    native.genrule(
        name=name + "_pygenrule",
        outs=[out],
        tools=[tool_name],
        cmd=("$(location " + tool_name + ") "
             + ("1" if require_shape_functions else "0") + " > $@"))

  # Make a py_library out of the generated python file.
  if not generated_target_name:
    generated_target_name = name
  native.py_library(name=generated_target_name,
                    srcs=[out],
                    srcs_version="PY2AND3",
                    visibility=visibility,
                    deps=[
                        "@org_tensorflow//tensorflow/python:framework_for_generated_wrappers",
                    ],)

I tried to find out other issues opened mentioning tf_gen_op_wrapper_py and I found this reference to mostly static link issues that were raised due to CI failures in early January.

bazelbuild/bazel#4474

@calberti @andorardo @bogatyy @markomernick is that Syntaxnet territory? Have you ever encountered the problem? Do you have any info as to what triggers the issue?

@dslomov is tha related to the mostly static link issue in Bazel?

Error logs

SUBCOMMAND: # //syntaxnet:parser_ops_pygenrule [action 'Executing genrule //syntaxnet:parser_ops_pygenrule']
(cd /root/.cache/bazel/_bazel_root/3b4c7ccb85580bc382ce4a52e9580003/execroot/main &&
exec env -
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PYTHON_BIN_PATH=/usr/bin/python
PYTHON_LIB_PATH=/usr/lib/python2.7
TF_DOWNLOAD_CLANG=0
TF_NEED_CUDA=0
TF_NEED_OPENCL_SYCL=0
/bin/bash -c 'source external/bazel_tools/tools/genrule/genrule-setup.sh; bazel-out/host/bin/syntaxnet/gen_parser_ops_py_wrappers_cc 0 > bazel-out/k8-opt/genfiles/syntaxnet/ops/gen_parser_ops.py')
ERROR: /models/research/syntaxnet/syntaxnet/BUILD:777:1: Executing genrule //syntaxnet:parser_ops_pygenrule failed (Exit 255): bash failed: error executing command

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions