Oppia Android: Bazel Build Fails On Mac Os Due To Missing Remote Java Tools Darwin #6046
-
Operating SystemMacOS Android Studio VersionAndroid Studio Giraffe | 2022.3.1 Patch 4 RAM size8 GB Free disk space100 GB Which step are you stuck on?I am stuck at the local build step while following the official Oppia Android installation guide: https://github.com/oppia/oppia-android/wiki/Installing-Oppia-Android Specifically, the failure occurs at the step where the app is built or run using Bazel: bazel build //:oppia_dev_binaryThe error happens during Bazel analysis / toolchain resolution, before any project code is compiled. Error LogERROR: external/rules_java/toolchains/BUILD:116:14:
no such package '@remote_java_tools_darwin//':
The repository '@remote_java_tools_darwin' could not be resolved
referenced by '@rules_java//toolchains:ijar_prebuilt_binary_darwin'
ERROR: Analysis of target '//:oppia_dev_binary' failed; build aborted
register_toolchains("@rules_java//toolchains:remote_toolchain")
ERROR: invalid registered toolchain '@rules_java//toolchains:remote_toolchain'Approaches already used to resolve the issueApproaches already used to resolve the issue I tried the following troubleshooting steps: Verified Bazel version matches .bazelversion (Bazel 6.5.0) Confirmed Bazel is using remotejdk_11 via bazel info Verified .bazelrc already enforces: build --java_runtime_version=remotejdk_11
build --tool_java_runtime_version=remotejdk_11Disabled bzlmod Verified WORKSPACE includes: rules_java_dependencies()
rules_java_toolchains()Installed Xcode 15.4 alongside Xcode 16 and explicitly selected it: sudo xcode-select -s /Applications/Xcode-15.4.app/Contents/DeveloperVerified Xcode selection: Fully reset Bazel state multiple times: bazel shutdown
bazel clean --expungeAttempted explicit Java toolchain registration (resulted in invalid toolchain error) None of the above resolved the issue. Additional informationOS: macOS (Apple Silicon, M-series) Android Studio: Giraffe | 2022.3.1 Patch 4 Android Studio runtime (JBR): 17.0.6 (aarch64) Java used by Bazel: Embedded remotejdk_11 Repo state: Clean clone The failure appears to be an upstream incompatibility involving Bazel 6.5.0, the pinned rules_java version, and macOS Darwin toolchains, where @remote_java_tools_darwin is never materialized. Local macOS builds are currently blocked at the toolchain resolution stage. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 8 replies
-
|
Hi @Sandesh282, this is an issue that we experience on Macs that we haven't been able to fully resolve yet. Please see #5791. My workaround is to open the problem BUILD file by running:
Then replacing the contents with the ones in the gist below: https://gist.github.com/adhiamboperes/8a213c84d4127db23ac660ae16e76fa2 The gist is modified to provide the missing tools. We are currently working on upgrading the project Bazel support to a newer version, and will hopefully have native support for Apple Silicon Macs. Please see #6021. |
Beta Was this translation helpful? Give feedback.
@Sandesh282 you'll need to import
remote_jdk19_reposas it should be declared in the same file asrules_java_dependencies(per bazelbuild/rules_java#106). Alternatively that PR landed in 6.0.0. I'm not sure if we can userules_java6.0.0 but that's definitely worth a shot (and probably is what you should try first). If 6.0.0 doesn't work with Bazel 6.5.0 or causes some other issue (like an incompatibility withrules_kotlinorrules_proto) then the following should probably work:Replace the following:
oppia-android/WORKSPACE
Lines 26 to 30 in ed9d8d2