google / fleetbench

Benchmarking suite for Google workloads
Apache License 2.0
116 stars 10 forks source link

bazel threw out errors when building #5

Closed DouglasYu closed 1 year ago

DouglasYu commented 1 year ago

Environment

os: ubuntu kernel: 5.15.0-56-generic cpu: x86_64

Output from bazel version

Build label: 6.0.0 Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar Build time: Mon Dec 19 15:52:35 2022 (1671465155) Build timestamp: 1671465155 Build timestamp as int: 1671465155

Command I ran

bazel run -c opt fleetbench/swissmap:hot_swissmap_benchmark

Result

ERROR: /home/user1/.cache/bazel/_bazel_user1/d0ccc3366f5edc4e660a0237ca9928bc/external/bazel_tools/platforms/BUILD:89:6: in alias rule @bazel_tools//platforms:windows: Constraints from @bazel_tools//platforms have been removed. Please use constraints from @platforms repository embedded in Bazel, or preferably declare dependency on https://github.com/bazelbuild/platforms. See https://github.com/bazelbuild/bazel/issues/8622 for details.
ERROR: /home/user1/.cache/bazel/_bazel_user1/d0ccc3366f5edc4e660a0237ca9928bc/external/bazel_tools/platforms/BUILD:89:6: Analysis of target '@bazel_tools//platforms:windows' failed
ERROR: /home/user1/fleetbench/fleetbench/swissmap/BUILD:44:28: While resolving toolchains for target //fleetbench/swissmap:hot_swissmap_benchmark: invalid registered toolchain '@bazel_skylib//toolchains/unittest:cmd_toolchain': 
ERROR: Analysis of target '//fleetbench/swissmap:hot_swissmap_benchmark' failed; build aborted: 
INFO: Elapsed time: 0.250s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded, 1 target configured)
ERROR: Build failed. Not running target

I believe this is a compatibility problem. I'm new to bazel and I didn't find any clues to solve it.

liyuying0000 commented 1 year ago

Hi, @DouglasYu,

Happy new year! The reason for this failure is the latest version of Bazel changed from 5.4 to 6.0. This is a known issue in bazel, please see this link for details, which recommends downgrading to 5.4 as a workaround.

If you already have Bazel 6.0.0 installed, running following commands (on Linux) will allow you to run Bazel 5.4.0:

sudo apt install bazel-5.4.0 This installs Bazel 5.4.0 as /usr/bin/bazel-1.0.0 on your system.

Then, you can set bazel to a specific version by creating a symlink: sudo ln -sf /usr/bin/bazel-5.4.0 /usr/bin/bazel

bazel version should show current version is set to 5.4.0 successfully:

Build label: 5.4.0 Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar Build time: Thu Dec 15 16:14:25 2022 (1671120865) Build timestamp: 1671120865 Build timestamp as int: 1671120865

You should be able to build and run the benchmark now :)

DouglasYu commented 1 year ago

Yeah the benchmark is working now. Thank you so much and happy new year!

liyuying0000 commented 1 year ago

Some quick updates -- this issue is fixed in d765040. Fleetbench can now build and run with bazel 6.0.0.