Giter Club home page Giter Club logo

Comments (8)

comius avatar comius commented on June 11, 2024 1

I can work with a large reproducer.

Reverting would cause other problems. There's a usecase where JDK gets packaged for deployment, so it needs to be matched by the target.

Is this only problem for android?

You can get extra debug by adding flag:
--toolchain_resolution_debug='@bazel_tools//tools/jdk:runtime_toolchain_type'

from rules_java.

jpsim avatar jpsim commented on June 11, 2024

Is this only problem for android?

Yes, but only in the sense that we don't compile Java for any other platform, we compile C/C++/Python/ObjC/Swift for other platforms that aren't affected by this, but maybe that's obvious.

Actually it looks like this envoyproxy/envoy#22356 fixes the issue, but now bazel can't find the C++ toolchain:

ERROR: /private/var/tmp/_bazel_jsimard/7140f038a5c13b01a171c93151a000da/external/bazel_tools/tools/cpp/BUILD:60:19: While resolving toolchains for target @bazel_tools//tools/cpp:current_cc_toolchain: No matching toolchains found for types @bazel_tools//tools/cpp:toolchain_type. Maybe --incompatible_use_cc_configure_from_rules_cc has been flipped and there is no default C++ toolchain added in the WORKSPACE file? See https://github.com/bazelbuild/bazel/issues/10134 for details and migration instructions.

Maybe rules_java needs to use use_cpp_toolchain() somewhere?

Update:

Full error
$ ./bazelw build android_dist --config=android --override_repository=rules_java=/Users/jsimard/src/rules_java                                                                                                                            
INFO: Build option --toolchain_resolution_debug has changed, discarding analysis cache.
INFO: Repository remotejdk11_macos_aarch64 instantiated at:
  /Users/jsimard/src/envoy-mobile/WORKSPACE:58:26: in <toplevel>
  /private/var/tmp/_bazel_jsimard/7140f038a5c13b01a171c93151a000da/external/envoy_mobile/bazel/envoy_mobile_dependencies.bzl:52:24: in envoy_mobile_dependencies
  /private/var/tmp/_bazel_jsimard/7140f038a5c13b01a171c93151a000da/external/envoy_mobile/bazel/envoy_mobile_dependencies.bzl:61:28: in kotlin_dependencies
  /private/var/tmp/_bazel_jsimard/7140f038a5c13b01a171c93151a000da/external/rules_java/java/repositories.bzl:517:23: in rules_java_dependencies
  /private/var/tmp/_bazel_jsimard/7140f038a5c13b01a171c93151a000da/external/rules_java/java/repositories.bzl:251:10: in remote_jdk11_repos
  /private/var/tmp/_bazel_jsimard/7140f038a5c13b01a171c93151a000da/external/bazel_tools/tools/build_defs/repo/utils.bzl:233:18: in maybe
  /private/var/tmp/_bazel_jsimard/7140f038a5c13b01a171c93151a000da/external/rules_java/toolchains/remote_java_repository.bzl:48:17: in remote_java_repository
Repository rule http_archive defined at:
  /private/var/tmp/_bazel_jsimard/7140f038a5c13b01a171c93151a000da/external/bazel_tools/tools/build_defs/repo/http.bzl:353:31: in <toplevel>
INFO: Repository maven instantiated at:
  /Users/jsimard/src/envoy-mobile/WORKSPACE:58:26: in <toplevel>
  /private/var/tmp/_bazel_jsimard/7140f038a5c13b01a171c93151a000da/external/envoy_mobile/bazel/envoy_mobile_dependencies.bzl:52:24: in envoy_mobile_dependencies
  /private/var/tmp/_bazel_jsimard/7140f038a5c13b01a171c93151a000da/external/envoy_mobile/bazel/envoy_mobile_dependencies.bzl:62:18: in kotlin_dependencies
  /private/var/tmp/_bazel_jsimard/7140f038a5c13b01a171c93151a000da/external/rules_jvm_external/defs.bzl:121:19: in maven_install
Repository rule coursier_fetch defined at:
  /private/var/tmp/_bazel_jsimard/7140f038a5c13b01a171c93151a000da/external/rules_jvm_external/coursier.bzl:1173:33: in <toplevel>
INFO: Repository android_tools instantiated at:
  /DEFAULT.WORKSPACE.SUFFIX:413:13: in <toplevel>
Repository rule http_archive defined at:
  /private/var/tmp/_bazel_jsimard/7140f038a5c13b01a171c93151a000da/external/bazel_tools/tools/build_defs/repo/http.bzl:353:31: in <toplevel>
ERROR: /private/var/tmp/_bazel_jsimard/7140f038a5c13b01a171c93151a000da/external/bazel_tools/tools/cpp/BUILD:60:19: While resolving toolchains for target @bazel_tools//tools/cpp:current_cc_toolchain: No matching toolchains found for types @bazel_tools//tools/cpp:toolchain_type. Maybe --incompatible_use_cc_configure_from_rules_cc has been flipped and there is no default C++ toolchain added in the WORKSPACE file? See https://github.com/bazelbuild/bazel/issues/10134 for details and migration instructions.
ERROR: Analysis of target '//:android_dist' failed; build aborted: 
INFO: Elapsed time: 0.221s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (1 packages loaded, 1336 targets configured)

from rules_java.

comius avatar comius commented on June 11, 2024

cc @katre Do you know anything on top of your head about this?

from rules_java.

keith avatar keith commented on June 11, 2024

Here's a smaller repro case keith/bazel-rust-mobile-demo#3, passing --java_runtime_version=remotejdk_11 is what triggers things. Versus it defaulting to the local_jdk (maybe arm64 darwin specific?)

from rules_java.

keith avatar keith commented on June 11, 2024

Verified it repros on x86_64 macOS as well

from rules_java.

jpsim avatar jpsim commented on June 11, 2024

@comius @katre with the repro cases we've shared, do you have enough to go on to debug this? Envoy Mobile is temporarily unblocked by pointing to the branch from #65 but that's not something we want to keep long term.

from rules_java.

jlaxson avatar jlaxson commented on June 11, 2024

I have a bunch of issues caused by the same problem, described at bazelbuild/bazel#17085. There's a reproducer there for several variants (wrong binaries used on exec platform, toolchain resolution failures that entirely break builds that use globs). @comius

from rules_java.

RyanTheOptimist avatar RyanTheOptimist commented on June 11, 2024

This is still causing problem for the Envoy project and is blocking our move to bazel 6.2.0. Is there any more information we can provide to expedite this?

from rules_java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.