Skip to content

Bazel errors building latest Master #336

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
JimClarke5 opened this issue Jun 14, 2021 · 6 comments
Closed

Bazel errors building latest Master #336

JimClarke5 opened this issue Jun 14, 2021 · 6 comments

Comments

@JimClarke5
Copy link
Contributor

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'
@karllessard
Copy link
Collaborator

Yes @JimClarke5 , since we've migrated to TF2.5, a newer version of Bazel is now required. The CI build now uses 3.7.2. So you just need to update it on your side as well.

Sorry I just have sent a communication about this, we probably need to update the contributor guide to specify it but even there you would not have been notified.

@JimClarke5
Copy link
Contributor Author

Thanks @karllessard.
How about adding tensorflow-core-api/.bazelversion to the repository?

@karllessard
Copy link
Collaborator

Sure! Want to add it up?

@JimClarke5
Copy link
Contributor Author

I pushed it in the latest Metrics PR #337. If you think that will take too long to merge, I can do a standalone PR just for that.

@karllessard
Copy link
Collaborator

Yes if you can make a separate PR just for this @JimClarke5 , that would be great. Closing this issue now.

@rnett
Copy link
Contributor

rnett commented Jun 16, 2021

@JimClarke5 I can add it to #235, I had it there at one point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants