Many Resources Fail to Be Automatically Obtained for Bazel Build When Porting TensorFlow 2.4.1
Symptom
Due to network problems, many resources cannot be automatically obtained during bazel build. You need to download the required resources and change the URLs in the build file to the local paths.

Key Process and Cause Analysis
A network exception occurs.
Conclusion and Solution
- Run the following command in the build directory and /root/.cache/bazel/_bazel_root directory:
grep -rn "c83ed7ea9eb5fb3b93d1ad52b59750f1958b8bde.tar.gz"
The following information is displayed:

- Find url = …… and open the file to the corresponding line (line 239 in this example):
vim b9ee4e17aa65b8928460ddaabd4265de/external/com_github_grpc_grpc/bazel/grpc_deps.bzl

- Create a local source path.
mkdir -p /path/to/tenflor_requires && cd /path/to/tenflor_requires
- Download the required dependencies based on the displayed URL.
wget https://github.com/envoyproxy/data-plane-api/archive/c83ed7ea9eb5fb3b93d1ad52b59750f1958b8bde.tar.gz --no-check-certificate
- Modify the preceding URL as follows:
name = "envoy_api", sha256 = "9e8cf42abce32c9b0e9e271b0cb62803084cbe5e5b49f5d5c2aef0766f9d69ca", strip_prefix = "data-plane-api-c83ed7ea9eb5fb3b93d1ad52b59750f1958b8bde", #url = "https://github.com/envoyproxy/data-plane-api/archive/c83ed7ea9eb5fb3b93d1ad52b59750f1958b8bde.tar.gz", url="file:///path/to/tenflor_requires/c83ed7ea9eb5fb3b93d1ad52b59750f1958b8bde.tar.gz",
- Continue to run the build command. This problem may occur multiple times during subsequent builds. You can use the preceding method to rectify the fault.
A variable may be used for the packet name. If the URL is not matched, delete the package name and run the grep command to match the URL.

If the following information is displayed, all dependencies have been obtained and the compilation is in progress.

Parent topic: Troubleshooting