Skip to content

Bazel errors building latest Master #336

Closed
@JimClarke5

Description

@JimClarke5

I am getting bazel errors when building from Master.

At first, with my original bazel version "bazel 3.1.0"

INFO: Found applicable config definition build:macos in file /Users/jbclarke/Code/tensorflow/java/tensorflow-core/tensorflow-core-api/.bazelrc: --copt=-w --define=PREFIX=/usr --define=LIBDIR=$(PREFIX)/lib --define=INCLUDEDIR=$(PREFIX)/include --define=PROTOBUF_INCLUDE_PATH=$(PREFIX)/include --cxxopt=-std=c++14 --host_cxxopt=-std=c++14
ERROR: /private/var/tmp/_bazel_jbclarke/6d259067b5cfdcb6df27dfdfc33b3066/external/org_tensorflow/tensorflow/core/kernels/mlir_generated/build_defs.bzl:175:24: rule() got unexpected keyword argument 'incompatible_use_toolchain_transition'
ERROR: Analysis of target '@org_tensorflow//tensorflow/tools/lib_package:jnilicenses_generate' failed; build aborted: error loading package '@org_tensorflow//tensorflow/core/kernels': Extension file 'tensorflow/core/kernels/mlir_generated/build_defs.bzl' has errors

The first errors where in the TensorFlow build itself, so I updated to baselisk as per the build instructions for TensorFlow.
Build from source.

After that I started getting errors in tensorflow-core-api.

INFO: Found applicable config definition build:macos in file /Users/jbclarke/Code/java/tensorflow-core/tensorflow-core-api/.bazelrc: --copt=-w --define=PREFIX=/usr --define=LIBDIR=$(PREFIX)/lib --define=INCLUDEDIR=$(PREFIX)/include --define=PROTOBUF_INCLUDE_PATH=$(PREFIX)/include --cxxopt=-std=c++14 --host_cxxopt=-std=c++14
ERROR: /Users/jbclarke/Code/java/tensorflow-core/tensorflow-core-api/WORKSPACE:18:84: invalid escape sequence: \(. You can enable unknown escape sequences by passing the flag --incompatible_restrict_string_escapes=false
ERROR: /Users/jbclarke/Code/java/tensorflow-core/tensorflow-core-api/WORKSPACE:18:109: invalid escape sequence: \.. You can enable unknown escape sequences by passing the flag --incompatible_restrict_string_escapes=false
ERROR: /Users/jbclarke/Code/java/tensorflow-core/tensorflow-core-api/WORKSPACE:18:121: invalid escape sequence: \.. You can enable unknown escape sequences by passing the flag --incompatible_restrict_string_escapes=false
ERROR: /Users/jbclarke/Code/java/tensorflow-core/tensorflow-core-api/WORKSPACE:18:123: invalid escape sequence: \). You can enable unknown escape sequences by passing the flag --incompatible_restrict_string_escapes=false
ERROR: /Users/jbclarke/Code/java/tensorflow-core/tensorflow-core-api/WORKSPACE:18:125: invalid escape sequence: \(. You can enable unknown escape sequences by passing the flag --incompatible_restrict_string_escapes=false
ERROR: /Users/jbclarke/Code/java/tensorflow-core/tensorflow-core-api/WORKSPACE:18:131: invalid escape sequence: \). You can enable unknown escape sequences by passing the flag --incompatible_restrict_string_escapes=false
ERROR: error loading package 'external': Failed to parse WORKSPACE file

I tried to add -incompatible_restrict_string_escapes=false to build.sh
"BUILD_FLAGS="$BUILD_FLAGS --experimental_repo_remote_exec --python_path="$PYTHON_BIN_PATH" --output_filter=DONT_MATCH_ANYTHING --verbose_failures -incompatible_restrict_string_escapes=false"

But the build did not recognize the option -incompatible_restrict_string_escapes

Finally, I had to copy the .bazelversion file (presently version 3.7.2) from the @org_tensorflow source, to tensorflow-core-api/.bazelversion.

Shouldn't we update out build system to match the current TensorFlow build (e.g copy .bazelversion to tensorflow-core-api/?
TensorFlow only requires the bazel version to be between _TF_MIN_BAZEL_VERSION and _TF_MAX_BAZEL_VERSION, as defined in @org_tensorflow/configure.py.

Presently defined as:

_TF_MIN_BAZEL_VERSION = '3.7.2'
_TF_MAX_BAZEL_VERSION = '3.99.0'

Metadata

Metadata

Assignees

No one assigned

    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