bazelbuild / bazelisk

A user-friendly launcher for Bazel.
Apache License 2.0
1.95k stars 300 forks source link

could not download Bazel when I want to execute the command:bazel build onos #555

Closed IBBLdeSS closed 4 months ago

IBBLdeSS commented 4 months ago
  1. Ubuntu 20.04 (LTS) uses OpenJDK 11
  2. Install Bazelisk: 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 bazel version
  3. Build ONOS from source:

    from Gerrit

    git clone https://gerrit.onosproject.org/onos

  4. cd onos bazel build onos Then got error: bs@bs-virtual-machine:~/onos/onos$ bazel build onos 2024/02/13 22:00:24 Downloading https://releases.bazel.build/6.0.0-pre.20220421.3/release/bazel-6.0.0-pre.20220421.3-linux-x86_64... 2024/02/13 22:00:25 could not download Bazel: HTTP GET https://releases.bazel.build/6.0.0-pre.20220421.3/release/bazel-6.0.0-pre.20220421.3-linux-x86_64 failed with error 404
IBBLdeSS commented 4 months ago

It looks like it's a problem with the URL https://releases.bazel.build/6.0.0-pre.20220421.3/release/bazel-6.0.0-pre.20220421.3-linux-x86_64..., the web page has no content, but I don't know how to fix it

meteorcloudy commented 4 months ago

The correct URL is https://releases.bazel.build/6.0.0/rolling/6.0.0-pre.20220421.3/bazel-6.0.0-pre.20220421.3-linux-x86_64

meteorcloudy commented 4 months ago

@IBBLdeSS How are you specifying the bazel version? In .bazelversion file? Can you share the content?

IBBLdeSS commented 4 months ago

The correct URL is https://releases.bazel.build/6.0.0/rolling/6.0.0-pre.20220421.3/bazel-6.0.0-pre.20220421.3-linux-x86_64

Oh ,yes ,but I don't know how to change the URL

IBBLdeSS commented 4 months ago

The content of the previous .bazelversion file was:

1707879620236

@IBBLdeSS How are you specifying the bazel version? In .bazelversion file? Can you share the content?

meteorcloudy commented 4 months ago

I couldn't reproduce this, do you have any other Bazelisk related environment variable set?

IBBLdeSS commented 4 months ago

Thanks for the tip, I manually downloaded bazel-6.0.0-pre.20220421.3-linux-x86_64 and put it in the specified folder:home/.cache/bazelisk/bin/bazelbuild, resolved the URL error,but I got new errors:

Extracting Bazel installation... Starting local Bazel server and connecting to it... INFO: Repository npm instantiated at: /home/ss/onos/onos/WORKSPACE:173:13: in /home/ss/.cache/bazel/_bazel_ss/6eb2507d8948b213aba0a0b56069db8a/external/build_bazel_rules_nodejs/index.bzl:89:18: in yarn_install Repository rule yarn_install defined at: /home/ss/.cache/bazel/_bazel_ss/6eb2507d8948b213aba0a0b56069db8a/external/build_bazel_rules_nodejs/internal/npm_install/npm_install.bzl:424:31: in ERROR: An error occurred during the fetch of repository 'npm': Traceback (most recent call last): File "/home/ss/.cache/bazel/_bazel_ss/6eb2507d8948b213aba0a0b56069db8a/external/build_bazel_rules_nodejs/internal/npm_install/npm_install.bzl", line 417, column 13, in _yarn_install_impl fail("yarn_install failed: %s (%s)" % (result.stdout, result.stderr)) Error in fail: yarn_install failed: yarn install v1.19.1 [1/5] Validating package.json... [2/5] Resolving packages... [3/5] Fetching packages... info If you think this is a bug, please open a bug report with the information provided in "/home/ss/onos/onos/web/gui2/yarn-error.log". info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command. (error An unexpected error occurred: "https://registry.yarnpkg.com/@angular/core/-/core-10.2.4.tgz: connect ECONNREFUSED 104.16.27.34:443". ) ERROR: /home/ss/onos/onos/WORKSPACE:173:13: fetching yarn_install rule //external:npm: Traceback (most recent call last): File "/home/ss/.cache/bazel/_bazel_ss/6eb2507d8948b213aba0a0b56069db8a/external/build_bazel_rules_nodejs/internal/npm_install/npm_install.bzl", line 417, column 13, in _yarn_install_impl fail("yarn_install failed: %s (%s)" % (result.stdout, result.stderr)) Error in fail: yarn_install failed: yarn install v1.19.1 [1/5] Validating package.json... [2/5] Resolving packages... [3/5] Fetching packages... info If you think this is a bug, please open a bug report with the information provided in "/home/ss/onos/onos/web/gui2/yarn-error.log". info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command. (error An unexpected error occurred: "https://registry.yarnpkg.com/@angular/core/-/core-10.2.4.tgz: connect ECONNREFUSED 104.16.27.34:443". ) ERROR: no such package '@npm//@bazel/protractor': yarn_install failed: yarn install v1.19.1 [1/5] Validating package.json... [2/5] Resolving packages... [3/5] Fetching packages... info If you think this is a bug, please open a bug report with the information provided in "/home/ss/onos/onos/web/gui2/yarn-error.log". info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command. (error An unexpected error occurred: "https://registry.yarnpkg.com/@angular/core/-/core-10.2.4.tgz: connect ECONNREFUSED 104.16.27.34:443". ) INFO: Elapsed time: 34.441s INFO: 0 processes. FAILED: Build did NOT complete successfully (0 packages loaded)

I couldn't reproduce this, do you have any other Bazelisk related environment variable set?

IBBLdeSS commented 4 months ago

Now facing these problems:

$ bazel build onos WARNING: Download from https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/rules_go/releases/download/v0.19.8/rules_go-v0.19.8.tar.gz failed: class java.net.ConnectException Connection refused (Connection refused) WARNING: Download from https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/bazel-gazelle/releases/download/0.18.1/bazel-gazelle-0.18.1.tar.gz failed: class java.net.ConnectException Connection refused (Connection refused) INFO: Analyzed target //:onos (0 packages loaded, 0 targets configured). INFO: Found 1 target... ERROR: /home/ss/onos/onos/web/gui/BUILD:98:8: Executing genrule //web/gui:_onos-gui-npm-install failed: (Exit 1): bash failed: error executing command (from target //web/gui:_onos-gui-npm-install) /bin/bash -c ... (remaining 1 argument skipped)

Use --sandbox_debug to see verbose messages from the sandbox Target //:onos failed to build Use --verbose_failures to see the command lines of failed build steps. ERROR: /home/ss/onos/onos/web/gui/BUILD:241:8 Executing genrule //web/gui:onos-web-gui failed: (Exit 1): bash failed: error executing command (from target //web/gui:_onos-gui-npm-install) /bin/bash -c ... (remaining 1 argument skipped)

Use --sandbox_debug to see verbose messages from the sandbox INFO: Elapsed time: 511.988s, Critical Path: 511.45s INFO: 2 processes: 2 internal. FAILED: Build did NOT complete successfully

fweikert commented 4 months ago

Why are you using this specific Bazel version? It's a prerelease version for Bazel 6.0, which doesn't really make sense to use nowadays.

Your options:

The failures you mentioned in the last comment are unrelated to Bazelisk - Bazel cannot download some external dependencies, maybe due to a firewall or some other network settings.