bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
23.07k stars 4.04k forks source link

`bazel build src/tools/execlog:parser` fails #22921

Closed andportnoy closed 3 months ago

andportnoy commented 3 months ago

Page link:

https://bazel.build/remote/cache-remote#compare-logs

Problem description (include actual vs expected text, if applicable):

Instructions on the linked page suggest running bazel build src/tools/execlog:parser, but that fails with an error:

$ bazel build src/tools/execlog:parser
WARNING: The following rc files are no longer being read, please transfer their contents or import their path into one of the standard rc files:
.bazelrc
WARNING: Invoking Bazel in batch mode since it is not invoked from within a workspace (below a directory having a WORKSPACE file).
ERROR: The 'build' command is only supported from within a workspace (below a directory having a WORKSPACE file).
See documentation at https://bazel.build/concepts/build-ref#workspace

Seems to be related to the removal of the WORKSPACE file: https://github.com/bazelbuild/bazel/pull/22657.

Where do you see this issue? (include link to specific section of the page, if applicable)

No response

Any other information you'd like to share?

$ bazel --version
bazel 6.1.2
yaoddao commented 3 months ago

On Bazel.6.2.1, I met the same issue, but it works on Bazel.7.2.1.

andportnoy commented 3 months ago

On Bazel.6.2.1, I met the same issue, but it works on Bazel.7.2.1.

Didn't work for me:

$ ./bazel-7.2.1-linux-x86_64 build src/tools/execlog:parser
WARNING: Invoking Bazel in batch mode since it is not invoked from within a workspace (below a directory having a WORKSPACE file).
Extracting Bazel installation...
OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
ERROR: The 'build' command is only supported from within a workspace (below a directory having a WORKSPACE file).
See documentation at https://bazel.build/concepts/build-ref#workspace
meteorcloudy commented 3 months ago

@andportnoy It looks like you are running under the wrong directory.

It should work under the bazel's source:

pcloudy@pcloudy-macbookpro3:~/workspace/bazel (master), (bazel 7.2.1)
$ bazel build src/tools/execlog:parser
Starting local Bazel server and connecting to it...
INFO: Invocation ID: 89160548-2d7b-436b-98c1-05c34a2b675b
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=1 --terminal_columns=80
INFO: Reading rc options for 'build' from /Users/pcloudy/workspace/bazel/.bazelrc:
  Inherited 'common' options: --enable_platform_specific_config --check_direct_dependencies=error --experimental_downloader_config=bazel_downloader.cfg --incompatible_disallow_empty_glob
INFO: Reading rc options for 'build' from /Users/pcloudy/workspace/bazel/.bazelrc:
  'build' options: --java_runtime_version=21 --java_language_version=21 --tool_java_language_version=21 --tool_java_runtime_version=21
INFO: Reading rc options for 'build' from /Users/pcloudy/.bazelrc:
  'build' options: --verbose_failures --announce_rc --disk_cache=/tmp/bazel_disk_cache --repository_cache=/tmp/bazel_repository_cache
INFO: Found applicable config definition build:macos in file /Users/pcloudy/workspace/bazel/.bazelrc: --macos_minimum_os=10.13 --cxxopt=-std=c++17 --host_cxxopt=-std=c++17
INFO: Analyzed target //src/tools/execlog:parser (122 packages loaded, 2548 targets configured).
INFO: Found 1 target...
Target //src/tools/execlog:parser up-to-date:
  bazel-bin/src/tools/execlog/parser
  bazel-bin/src/tools/execlog/parser.jar
INFO: Elapsed time: 8.554s, Critical Path: 1.15s
INFO: 7 processes: 5 internal, 2 worker.
INFO: Build completed successfully, 7 total actions