oppia-android
oppia-android copied to clipboard
Tracking all the bazel setup related issues
Keeping Track of all the bazel related errors and how to resolve them
Instructions on how to add a bazel setup error here
Check out the Bazel setup instructions before adding a comment
Include the following in the comment
- Run the following commands to verify the basic setup
echo $ANDROID_HOME-> /home/<user_name>/Android/Sdk (i.e sdk path)bazel --version-> bazel 4.0.0 (The oppia-bazel-tools only works correctly with 4.0.0 + versions)which bazel-> /usr/bin/bazel (Verify the path of bazel)cat ~/.bazelrc-> (To check if the instructions in the oppia-bazel-tools are followed)
build --override_repository=android_tools=/home/<username>/opensource/oppia-bazel-tools
build --android_databinding_use_androidx
Check if the path of the project is correctly specified
[ -d "/home/<username>/opensource/oppia-bazel-tools" ] && echo "Directory /home/<username>/opensource/oppia-bazel-tools exists." || echo "Error: Directory /home/farees/opensource/oppia-bazel-tools does not exists."
[ -d "/home/<username>/opensource/oppia-android" ] && echo "Directory /home/<username>/opensource/oppia-android." || echo "Error: Directory /home/farees/opensource/oppia-android does not exists."
Resolved Errors
When the Python path is not specified
Error
DEBUG: Rule 'robolectric' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "a7eac9418cc0b6d2527699986d5937efcebae927c3917c8bd3cb7663ee65ab63"
DEBUG: Repository robolectric instantiated at:
/home/titan/opensource/oppia-android/WORKSPACE:96:13: in <toplevel>
Repository rule http_archive defined at:
/home/titan/.cache/bazel/_bazel_titan/d2121258671c00ac2cf78dbca73dac8b/external/bazel_tools/tools/build_defs/repo/http.bzl:336:31: in <toplevel>
DEBUG: Rule 'tools_android' indicated that a canonical reproducible form can be obtained by modifying arguments shallow_since = "1594238320 -0400"
DEBUG: Repository tools_android instantiated at:
/home/titan/opensource/oppia-android/WORKSPACE:107:15: in <toplevel>
Repository rule git_repository defined at:
/home/titan/.cache/bazel/_bazel_titan/d2121258671c00ac2cf78dbca73dac8b/external/bazel_tools/tools/build_defs/repo/git.bzl:199:33: in <toplevel>
INFO: Repository maven instantiated at:
/home/titan/opensource/oppia-android/WORKSPACE:131:14: in <toplevel>
/home/titan/.cache/bazel/_bazel_titan/d2121258671c00ac2cf78dbca73dac8b/external/rules_jvm_external/defs.bzl:89:19: in maven_install
Repository rule coursier_fetch defined at:
/home/titan/.cache/bazel/_bazel_titan/d2121258671c00ac2cf78dbca73dac8b/external/rules_jvm_external/coursier.bzl:620:33: in <toplevel>
INFO: Repository 'maven' used the following cache hits instead of downloading the corresponding file.
* Hash '8f35f92fb8e021f96b3aa8145c66c3b2e29295baabb28ff50569e613438afcbd' for https://github.com/coursier/coursier/releases/download/v2.0.0-RC3-4/coursier.jar
If the definition of 'maven' was updated, verify that the hashes were also updated.
ERROR: An error occurred during the fetch of repository 'maven':
Traceback (most recent call last):
File "/home/titan/.cache/bazel/_bazel_titan/d2121258671c00ac2cf78dbca73dac8b/external/rules_jvm_external/coursier.bzl", line 467, column 17, in _coursier_fetch_impl
fail("Error while obtaining the sha256 checksum of "
Error in fail: Error while obtaining the sha256 checksum of v1/https/maven.google.com/android/arch/core/common/1.1.1/common-1.1.1.jar: src/main/tools/process-wrapper-legacy.cc:80: "execvp(python, ...)": No such file or directory
ERROR: Error fetching repository: Traceback (most recent call last):
File "/home/titan/.cache/bazel/_bazel_titan/d2121258671c00ac2cf78dbca73dac8b/external/rules_jvm_external/coursier.bzl", line 467, column 17, in _coursier_fetch_impl
fail("Error while obtaining the sha256 checksum of "
Error in fail: Error while obtaining the sha256 checksum of v1/https/maven.google.com/android/arch/core/common/1.1.1/common-1.1.1.jar: src/main/tools/process-wrapper-legacy.cc:80: "execvp(python, ...)": No such file or directory
ERROR: /home/titan/opensource/oppia-android/third_party/BUILD.bazel:21:17: //third_party:com_google_android_material_material depends on @maven//:com_google_android_material_material in repository @maven which failed to fetch. no such package '@maven//': Error while obtaining the sha256 checksum of v1/https/maven.google.com/android/arch/core/common/1.1.1/common-1.1.1.jar: src/main/tools/process-wrapper-legacy.cc:80: "execvp(python, ...)": No such file or directory
DEBUG: Rule 'circularimageview' indicated that a canonical reproducible form can be obtained by modifying arguments shallow_since = "1598049485 -0700"
DEBUG: Repository circularimageview instantiated at:
/home/titan/opensource/oppia-android/WORKSPACE:117:15: in <toplevel>
Repository rule git_repository defined at:
/home/titan/.cache/bazel/_bazel_titan/d2121258671c00ac2cf78dbca73dac8b/external/bazel_tools/tools/build_defs/repo/git.bzl:199:33: in <toplevel>
ERROR: Analysis of target '//:oppia' failed; build aborted: Analysis failed
INFO: Elapsed time: 115.769s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded, 0 targets conf\
igured)
\
Issue: https://github.com/bazelbuild/rules_jvm_external/issues/281#issuecomment-546757259
How to solve: Add the line PYTHONPATH=/usr/bin/python in the end of ~/.bashrc
Cc @BenHenning
This becomes a little complicated when you have both python2 and python3 on your system. Even after following these steps, I kept facing error, then upgrading my python2 version worked for me.
Even after following up on everything mentioned here, I have been always encountering errors while building that says:
An error occurred while fetching the repository 'maven' Error while fetching artifact with coursier: " + exec_result.stderr
Kindly help me out to solve this error if you know why exactly this error is shown. I read few issues on Github regarding artifacts that are fetched with the help of coursier and they depend on some third-party repositories that are downloaded only if a network proxy is set. @anandwana001 @BenHenning Can you please look into this?
This becomes a little complicated when you have both python2 and python3 on your system. Even after following these steps, I kept facing error, then upgrading my python2 version worked for me.
I had both python 2 and 3, I set it so that on calling the python command, python3 was used and then found the path for that. Setting the path to that worked for me
@MohitGupta121 Do you think you could update the wiki as needed based on this issue, and then let's close it?
@seanlip Yes sure, but I think after the Bazel setup thing is updated by this PR https://github.com/oppia/oppia-android/pull/4926
I already have Doc for common errors that come under Bazel build and setup, Also @BenHenning has common issues/errors that come from his 2 years of Bazel experience. So with that things, we can add a new section or wiki page for these errors.
OK sounds good, thanks! My only suggestion is to add it incrementally rather than all at once (i.e. no need to wait for everything to be complete before making a PR, just start one and get it merged and then Ben can add more to it, or vice versa). Otherwise everything gets bottlenecked.
(This is on the assumption that contributors will find a partial set of troubleshooting steps more useful than having none.)
Yes got it @seanlip Thanks, this approach is not block on long review also.