You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Bazel构建ONOS时遇报错问题求助

如何正确使用Bazel构建ONOS项目?

问题背景

  • 遵循ONOS项目官方构建指南安装最新版Bazel后,系统提示需使用特定版本Bazel 6.0.0-pre.20220421.3,但通过apt无法找到该包
  • 安装Bazel 6.0.0后无版本冲突提示,执行bazel-6.0.0 build onos时出现报错

报错详情

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

系统环境

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.5 LTS
Release:        22.04
Codename:       jammy

疑问补充

ONOS项目GitHub仓库无Issue板块,原谷歌群组已废弃,不清楚该通过什么渠道反馈项目问题?

验证可行的解决方案

使用Bazelisk自动适配并下载ONOS所需的Bazel版本,执行以下命令即可完成构建:

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

构建成功输出:

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

内容的提问来源于stack exchange,提问作者fengkeyleaf

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.14 06:28:26