Reputation: 1
I am building ONOS by following the instructions in the github: https://github.com/opennetworkinglab/onos
But after I installed the latest Bazel and built, it complained that
ERROR: The project you're trying to build requires Bazel 6.0.0-pre.20220421.3 (specified in /home/xt1643/CLionProjects/onos/.bazelversion), but it wasn't found in /usr/bin.
You can install the required Bazel version via apt:
sudo apt update && sudo apt install bazel-6.0.0-pre.20220421.3
If this doesn't work, check Bazel's installation instructions for help:
https://bazel.build/install/ubuntu
And I couldn't install Bazel 6.0.0-pre.20220421.3 since no such a package available:
0-pre.20220421.3
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package bazel-6.0.0-pre.20220421.3
E: Couldn't find any package by glob 'bazel-6.0.0-pre.20220421.3'
So I installed 6.0.0, it didn't complaint about the version conflict, but got a new error:
bazel-6.0.0 build onos
Starting local Bazel server and connecting to it...
ERROR: Traceback (most recent call last):
File "/home/xt1643/CLionProjects/onos/WORKSPACE", line 1, column 10, in <toplevel>
workspace(
Error in workspace: workspace() got unexpected keyword argument 'managed_directories'
ERROR: Error computing the main repository mapping: Encountered error while reading extension file 'tools/build_defs/repo/http.bzl': no such package '@bazel_tools//tools/build_defs/repo': error loading package 'external': Could not load //external package
I wonder if anyone knows how to build ONOS with Bazel successfully? Or any places to report error and I found out that there is no issue section in the github, and the google group is deprecated.
My System info:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.5 LTS
Release: 22.04
Codename: jammy
Updated: It seems that need to use Bazelisk to download the version required by onos, not following the official instructions. Commands provided by ChatGPT:
wget https://github.com/bazelbuild/bazelisk/releases/download/v1.18.0/bazelisk-linux-amd64
chmod +x bazelisk-linux-amd64
sudo mv bazelisk-linux-amd64 /usr/local/bin/bazel
cd path/to/onos
bazel build onos
And built successfully:
INFO: Elapsed time: 328.977s, Critical Path: 214.74s
INFO: 2530 processes: 211 internal, 2015 linux-sandbox, 2 local, 302 worker.
INFO: Build completed successfully, 2530 total actions
regards,
Upvotes: 0
Views: 16
Reputation: 1
Solved, please use Bazelisk to install Bazel. See the updates in the question to get the command lines.
Upvotes: 0