PAIR-code / what-if-tool

Source code/webpage/demos for the What-If Tool
https://pair-code.github.io/what-if-tool
Apache License 2.0
904 stars 168 forks source link

Build errors with Bazel 4.0.0, 3.7.2 #167

Open adamjstewart opened 3 years ago

adamjstewart commented 3 years ago

When I try to build with Bazel 4.0.0, I see the following build errors:

$ bazel --nohome_rc --nosystem_rc --output_user_root=/tmp/spackjloirg0g run --define=EXECUTOR=remote --verbose_failures --subcommands=pretty_print --spawn_strategy=local tensorboard_plugin_wit/pip_package:build_pip_package
$TEST_TMPDIR defined: output root default is '/tmp/spackjloirg0g' and max_idle_secs default is '15'.
Extracting Bazel installation...
Starting local Bazel server and connecting to it...
Loading:
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
ERROR: /tmp/spackjloirg0g/dbe23794a6948018e3519954f7cd2e6d/external/build_bazel_rules_nodejs/internal/node/node.bzl:86:45: invalid escape sequence: \/. You can enable unknown escape sequences by passing the flag --incompatible_restrict_string_escapes=false
ERROR: /tmp/spackjloirg0g/dbe23794a6948018e3519954f7cd2e6d/external/build_bazel_rules_nodejs/internal/node/node.bzl:86:64: invalid escape sequence: \.. You can enable unknown escape sequences by passing the flag --incompatible_restrict_string_escapes=false
ERROR: error loading package '': in /tmp/spackjloirg0g/dbe23794a6948018e3519954f7cd2e6d/external/build_bazel_rules_nodejs/defs.bzl: Extension 'internal/node/node.bzl' has errors
INFO: Elapsed time: 5.755s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
ERROR: Build failed. Not running target
FAILED: Build did NOT complete successfully (0 packages loaded)

If I add the --incompatible_restrict_string_escapes=false flag, then I see different errors:

ERROR: /tmp/spack0v2wg7jx/dbe23794a6948018e3519954f7cd2e6d/external/org_tensorflow_tensorboard/tensorboard/components/experimental/plugin_lib/BUILD:31:13: Bundling JavaScript ../org_tensorflow_tensorboard/tensorboard/components/experimental/plugin_lib/plugin_lib_polymer_interop_binary.es2015.js [rollup] failed: (Exit 1): rollup failed: error executing command
  (cd /tmp/spack0v2wg7jx/dbe23794a6948018e3519954f7cd2e6d/execroot/ai_google_pair_wit && \
  exec env - \
  bazel-out/host/bin/external/build_bazel_rules_nodejs/internal/rollup/rollup --config bazel-out/k8-fastbuild/bin/external/org_tensorflow_tensorboard/tensorboard/components/experimental/plugin_lib/_plugin_lib_polymer_interop_binary.rollup.conf.js --output.file bazel-out/k8-fastbuild/bin/external/org_tensorflow_tensorboard/tensorboard/components/experimental/plugin_lib/plugin_lib_polymer_interop_binary.es2015.js --output.sourcemap --output.sourcemapFile bazel-out/k8-fastbuild/bin/external/org_tensorflow_tensorboard/tensorboard/components/experimental/plugin_lib/plugin_lib_polymer_interop_binary.es2015.js.map --silent)
Execution platform: @local_config_platform//:host
[!] (commonjs plugin) Error: Could not resolve import 'ai_google_pair_wit/external/org_tensorflow_tensorboard/tensorboard/components/experimental/plugin_lib/polymer-interop' from 'undefined'
Error: Could not resolve import 'ai_google_pair_wit/external/org_tensorflow_tensorboard/tensorboard/components/experimental/plugin_lib/polymer-interop' from 'undefined'
    at Object.notResolved (/tmp/spack0v2wg7jx/dbe23794a6948018e3519954f7cd2e6d/execroot/ai_google_pair_wit/bazel-out/k8-fastbuild/bin/external/org_tensorflow_tensorboard/tensorboard/components/experimental/plugin_lib/_plugin_lib_polymer_interop_binary.rollup.conf.js:163:11)
    at /tmp/spack0v2wg7jx/dbe23794a6948018e3519954f7cd2e6d/execroot/ai_google_pair_wit/bazel-out/host/bin/external/build_bazel_rules_nodejs/internal/rollup/rollup.runfiles/build_bazel_rules_nodejs_rollup_deps/node_modules/rollup-plugin-commonjs/src/utils.js:20:68

Target //tensorboard_plugin_wit/pip_package:build_pip_package failed to build
ERROR: /tmp/t-astewart/spack-stage/spack-stage-py-tensorboard-plugin-wit-1.8.0-gklt5u5uuy3pbzqeec7fcf4mzcmxzvky/spack-src/tensorboard_plugin_wit/pip_package/BUILD:12:10 Middleman _middlemen/tensorboard_Uplugin_Uwit_Spip_Upackage_Sbuild_Upip_Upackage-runfiles failed: (Exit 1): rollup failed: error executing command
  (cd /tmp/spack0v2wg7jx/dbe23794a6948018e3519954f7cd2e6d/execroot/ai_google_pair_wit && \
  exec env - \
  bazel-out/host/bin/external/build_bazel_rules_nodejs/internal/rollup/rollup --config bazel-out/k8-fastbuild/bin/external/org_tensorflow_tensorboard/tensorboard/components/experimental/plugin_lib/_plugin_lib_polymer_interop_binary.rollup.conf.js --output.file bazel-out/k8-fastbuild/bin/external/org_tensorflow_tensorboard/tensorboard/components/experimental/plugin_lib/plugin_lib_polymer_interop_binary.es2015.js --output.sourcemap --output.sourcemapFile bazel-out/k8-fastbuild/bin/external/org_tensorflow_tensorboard/tensorboard/components/experimental/plugin_lib/plugin_lib_polymer_interop_binary.es2015.js.map --silent)
Execution platform: @local_config_platform//:host
INFO: Elapsed time: 93.063s, Critical Path: 10.38s
INFO: 1028 processes: 692 internal, 336 local.
FAILED: Build did NOT complete successfully
ERROR: Build failed. Not running target
FAILED: Build did NOT complete successfully

According to the WORKSPACE file, Bazel 0.26.1+ should be supported. What versions of Bazel are actually known to work? In #166 I also tried Bazel 2.1.0 and that didn't work either.

@aweits

adamjstewart commented 3 years ago

I get the same error with Bazel 3.7.2.

adamjstewart commented 3 years ago

The latter error message is the same reported in #140. I don't think the former error message has been reported yet so I'll keep this open.

adamjstewart commented 3 years ago

tensorboard 2.5.0 now requires Bazel 3.7.0+, and depends on tensorboard-plugin-wit. We really need to start supporting modern versions of Bazel.

jameswex commented 3 years ago

tensorboard's build uses the pre-built tensorboard-plugin-wit package, so there is no build break with the current setup. It isn't ideal that tensorboard-plugin-wit only builds with much older versions of bazel, but it shouldn't affect current tensorboard builds.

Are you making changes to wit that require rebuilding it for tensorboard?

adamjstewart commented 3 years ago

No changes, but I'm updating our Spack build recipes for tensorboard and tensorboard-plugin-wit. Spack builds all software from source so we can get optimized binaries for supercomputers. We could theoretically install from wheels if we need to, but we would rather avoid it if possible.