Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to build x86 based unit tests with bazel 6.0.0rc4 because there is no x86 based remote java toolchain #16961

Closed
carpenterjc opened this issue Dec 8, 2022 · 15 comments
Assignees
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Rules-Java Issues for Java rules type: bug

Comments

@carpenterjc
Copy link

carpenterjc commented Dec 8, 2022

Description of the bug:

We have a C++ toolchain with both intel x64 and x86 definitions.
When we build with x64 the tests work fine, when we build with x86 you can see the toolchain resolution doesn't find any remote_jdk_11 with the which matches the CPU.

ERROR: C:/dev/_bazel/jarbmqax/external/remote_coverage_tools/BUILD:10:12: While resolving toolchains for target @remote_coverage_tools//:Main: No matching toolchains found for types @bazel_tools//tools/jdk:runtime_toolchain_type.                                                                                                                                                                                                     
To debug, rerun with --toolchain_resolution_debug='@bazel_tools//tools/jdk:runtime_toolchain_type'                                                                                                                   
If platforms or toolchains are a new concept for you, we'd encourage reading https://bazel.build/concepts/platforms-intro.                                                                                     

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Unfortunately: You need a C++ toolchain with x64 and x86 support, we are using platforms.

When but just running bazel build with the x64 platform will work, as soon as we switch the to building with an x86 platform we get the toolchain resolution error.

We had to specify build --java_runtime_version=remotejdk_11 to get the build to work.

Which operating system are you running Bazel on?

Windows

What is the output of bazel info release?

release 6.0.0rc4

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

bazel version 
`Bazelisk version: v1.15.0
Build label: 6.0.0rc4
Build target: bazel-out/x64_windows-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Fri Dec 2 13:47:04 2022 (1669988824)
Build timestamp: 1669988824
Build timestamp as int: 1669988824
`



INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @local_jdk//:jdk; mismatching config settings: localjdk_setting
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk11_linux//:jdk; mismatching values: linux
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk11_linux_aarch64//:jdk; mismatching values: linux, arm64
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk11_linux_ppc64le//:jdk; mismatching values: linux, ppc
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk11_linux_s390x//:jdk; mismatching values: linux, s390x
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk11_macos//:jdk; mismatching values: osx              
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk11_macos_aarch64//:jdk; mismatching values: osx, arm64
INFO: ToolchainResolution:   Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: execution @local_config_platform//:host: Selected toolchain @remotejdk11_win//:jdk  
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk11_win_arm64//:jdk; mismatching values: arm64        
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk17_linux//:jdk; mismatching config settings: prefix_version_setting
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk17_linux_aarch64//:jdk; mismatching config settings: prefix_version_setting
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk17_macos//:jdk; mismatching config settings: prefix_version_setting
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk17_macos_aarch64//:jdk; mismatching config settings: prefix_version_setting
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk17_win//:jdk; mismatching config settings: prefix_version_setting
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk17_win_arm64//:jdk; mismatching config settings: prefix_version_setting
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk18_linux//:jdk; mismatching config settings: prefix_version_setting
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk18_linux_aarch64//:jdk; mismatching config settings: prefix_version_setting
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk18_macos//:jdk; mismatching config settings: prefix_version_setting
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk18_macos_aarch64//:jdk; mismatching config settings: prefix_version_setting
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk18_win//:jdk; mismatching config settings: prefix_version_setting
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk18_win_arm64//:jdk; mismatching config settings: prefix_version_setting
INFO: ToolchainResolution: Target platform @local_config_platform//:host: Selected execution platform @local_config_platform//:host, type @bazel_tools//tools/cpp:toolchain_type -> toolchain //tools/config:sophos_win_x64_toolchain, type @bazel_tools//tools/jdk:toolchain_type -> toolchain @bazel_tools//tools/jdk:toolchain_java11, type @bazel_tools//tools/jdk:runtime_toolchain_type -> toolchain @remotejdk11_win//:jdk
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @local_jdk//:jdk; mismatching config settings: localjdk_setting
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk11_linux//:jdk; mismatching values: linux            
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk11_linux_aarch64//:jdk; mismatching values: linux, arm64                                                                                                                                                                                                                  
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk11_linux_ppc64le//:jdk; mismatching values: linux, ppc
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk11_linux_s390x//:jdk; mismatching values: linux, s390x                                                                                                                                                                                                                    
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk11_macos//:jdk; mismatching values: osx              
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk11_macos_aarch64//:jdk; mismatching values: osx, arm64                                                                                                                                                                                                                    
INFO: ToolchainResolution:   Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: execution @local_config_platform//:host: Selected toolchain @remotejdk11_win//:jdk  
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk11_win_arm64//:jdk; mismatching values: arm64        
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk17_linux//:jdk; mismatching config settings: prefix_version_setting                                                                                                                                                                                                       
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk17_linux_aarch64//:jdk; mismatching config settings: prefix_version_setting                                                                                                                                                                                               
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk17_macos//:jdk; mismatching config settings: prefix_version_setting                                                                                                                                                                                                       
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk17_macos_aarch64//:jdk; mismatching config settings: prefix_version_setting                                                                                                                                                                                               
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk17_win//:jdk; mismatching config settings: prefix_version_setting                                                                                                                                                                                                         
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk17_win_arm64//:jdk; mismatching config settings: prefix_version_setting                                                                                                                                                                                                   
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk18_linux//:jdk; mismatching config settings: prefix_version_setting                                                                                                                                                                                                       
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk18_linux_aarch64//:jdk; mismatching config settings: prefix_version_setting                                                                                                                                                                                               
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk18_macos//:jdk; mismatching config settings: prefix_version_setting                                                                                                                                                                                                       
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk18_macos_aarch64//:jdk; mismatching config settings: prefix_version_setting
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk18_win//:jdk; mismatching config settings: prefix_version_setting                                                                                                                                                                                                         
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk18_win_arm64//:jdk; mismatching config settings: prefix_version_setting                                                                                                                                                                                                   
INFO: ToolchainResolution: Target platform @local_config_platform//:host: Selected execution platform @local_config_platform//:host, type @bazel_tools//tools/cpp:toolchain_type -> toolchain //tools/config:sophos_win_x64_toolchain, type @bazel_tools//tools/jdk:toolchain_type -> toolchain @bazel_tools//tools/jdk:toolchain_java8, type @bazel_tools//tools/jdk:runtime_toolchain_type -> toolchain @remotejdk11_win//:jdk          
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform //tools/config:win_x86_platform: Rejected toolchain @local_jdk//:jdk; mismatching config settings: localjdk_setting
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform //tools/config:win_x86_platform: Rejected toolchain @remotejdk11_linux//:jdk; mismatching values: linux, x86_64  
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform //tools/config:win_x86_platform: Rejected toolchain @remotejdk11_linux_aarch64//:jdk; mismatching values: linux, arm64                                                                                                                                                                                                                
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform //tools/config:win_x86_platform: Rejected toolchain @remotejdk11_linux_ppc64le//:jdk; mismatching values: linux, ppc                                                                                                                                                                                                                  
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform //tools/config:win_x86_platform: Rejected toolchain @remotejdk11_linux_s390x//:jdk; mismatching values: linux, s390x                                                                                                                                                                                                                  
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform //tools/config:win_x86_platform: Rejected toolchain @remotejdk11_macos//:jdk; mismatching values: osx, x86_64    
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform //tools/config:win_x86_platform: Rejected toolchain @remotejdk11_macos_aarch64//:jdk; mismatching values: osx, arm64                                                                                                                                                                                                                  
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform //tools/config:win_x86_platform: Rejected toolchain @remotejdk11_win//:jdk; mismatching values: x86_64           
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform //tools/config:win_x86_platform: Rejected toolchain @remotejdk11_win_arm64//:jdk; mismatching values: arm64      
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform //tools/config:win_x86_platform: Rejected toolchain @remotejdk17_linux//:jdk; mismatching config settings: prefix_version_setting                                                                                                                                                                                                     
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform //tools/config:win_x86_platform: Rejected toolchain @remotejdk17_linux_aarch64//:jdk; mismatching config settings: prefix_version_setting                                                                                                                                                                                             
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform //tools/config:win_x86_platform: Rejected toolchain @remotejdk17_macos//:jdk; mismatching config settings: prefix_version_setting
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform //tools/config:win_x86_platform: Rejected toolchain @remotejdk17_macos_aarch64//:jdk; mismatching config settings: prefix_version_setting                                                                                                                                                                                             
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform //tools/config:win_x86_platform: Rejected toolchain @remotejdk17_win//:jdk; mismatching config settings: prefix_version_setting                                                                                                                                                                                                       
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform //tools/config:win_x86_platform: Rejected toolchain @remotejdk17_win_arm64//:jdk; mismatching config settings: prefix_version_setting                                                                                                                                                                                                 
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform //tools/config:win_x86_platform: Rejected toolchain @remotejdk18_linux//:jdk; mismatching config settings: prefix_version_setting                                                                                                                                                                                                     
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform //tools/config:win_x86_platform: Rejected toolchain @remotejdk18_linux_aarch64//:jdk; mismatching config settings: prefix_version_setting                                                                                                                                                                                             
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform //tools/config:win_x86_platform: Rejected toolchain @remotejdk18_macos//:jdk; mismatching config settings: prefix_version_setting                                                                                                                                                                                                     
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform //tools/config:win_x86_platform: Rejected toolchain @remotejdk18_macos_aarch64//:jdk; mismatching config settings: prefix_version_setting                                                                                                                                                                                             
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform //tools/config:win_x86_platform: Rejected toolchain @remotejdk18_win//:jdk; mismatching config settings: prefix_version_setting                                                                                                                                                                                                       
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform //tools/config:win_x86_platform: Rejected toolchain @remotejdk18_win_arm64//:jdk; mismatching config settings: prefix_version_setting                                                                                                                                                                                                 
INFO: ToolchainResolution:   Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform //tools/config:win_x86_platform: No toolchains found.   
@Wyverald
Copy link
Member

Wyverald commented Dec 8, 2022

cc @hvadehra @comius for triage

Does this only happen with 6.0.0rc4? Have you tried to reproduce using 5.3.2?

@carpenterjc
Copy link
Author

This does not reproduce in bazel 5.3.2, or 5.4.0rc1

This is reproducible in bazel 6.0.0.rc1

@comius
Copy link
Contributor

comius commented Dec 9, 2022

It doesn't seem we ever had support for 32 bit windows:
https://github.com/bazelbuild/bazel/blob/5.3.2/src/main/java/com/google/devtools/build/lib/bazel/rules/java/jdk.WORKSPACE.tmpl

@carpenterjc
Can you provide what cpu and os constraints are you using in //tools/config:win_x86_platform. Are there additional constraints?
Can you provide output of toolchain resolution debug with bazel 5.3.2?

You should be able to register additional JDKs in your WORKSPACE with remote_java_repository following examples in jdk.WORKSPACE.tmpl.

@comius comius added P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) and removed untriaged labels Dec 9, 2022
@carpenterjc
Copy link
Author

carpenterjc commented Dec 9, 2022

The platform is:

    name = "win_x86_platform",
    constraint_values = [
        "@platforms//cpu:x86_32",
        "@platforms//os:windows",
        "@bazel_tools//tools/cpp:msvc",
    ],
)

Toolchain resolution debug:

INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: execution platform @local_config_platform//:host: Rejected toolchain @remotejdk11_linux//:jdk; mismatching values: linux
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: execution platform @local_config_platform//:host: Rejected toolchain @remotejdk11_linux_aarch64//:jdk; mismatching values: linux, arm64
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: execution platform @local_config_platform//:host: Rejected toolchain @remotejdk11_linux_ppc64le//:jdk; mismatching values: linux, ppc
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: execution platform @local_config_platform//:host: Rejected toolchain @remotejdk11_linux_s390x//:jdk; mismatching values: linux, s390x
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: execution platform @local_config_platform//:host: Rejected toolchain @remotejdk11_macos//:jdk; mismatching values: osx
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: execution platform @local_config_platform//:host: Rejected toolchain @remotejdk11_macos_aarch64//:jdk; mismatching values: osx, arm64
INFO: ToolchainResolution:   Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: execution @local_config_platform//:host: Selected toolchain @remotejdk11_win//:jdk
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk15_linux//:jdk; mismatching config settings: prefix_version_setting
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk15_macos//:jdk; mismatching config settings: prefix_version_setting
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk15_macos_aarch64//:jdk; mismatching config settings: prefix_version_setting
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk15_win//:jdk; mismatching config settings: prefix_version_setting
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk16_linux//:jdk; mismatching config settings: prefix_version_setting
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk16_macos//:jdk; mismatching config settings: prefix_version_setting
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk16_macos_aarch64//:jdk; mismatching config settings: prefix_version_setting
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk16_win//:jdk; mismatching config settings: prefix_version_setting
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk17_linux//:jdk; mismatching config settings: prefix_version_setting                                                                                                                                                                   
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk17_macos//:jdk; mismatching config settings: prefix_version_setting                                                                                                                                                                   
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk17_macos_aarch64//:jdk; mismatching config settings: prefix_version_setting                                                                                                                                                           
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk17_win//:jdk; mismatching config settings: prefix_version_setting                                                                                                                                                                     
INFO: ToolchainResolution:     Type @bazel_tools//tools/jdk:runtime_toolchain_type: target platform @local_config_platform//:host: Rejected toolchain @remotejdk17_win_arm64//:jdk; mismatching config settings: prefix_version_setting                                                                                                                                                               
INFO: ToolchainResolution: Target platform @local_config_platform//:host: Selected execution platform @local_config_platform//:host, type @bazel_tools//tools/jdk:runtime_toolchain_type -> toolchain @remotejdk11_win//:jdk         

@carpenterjc
Copy link
Author

I have a hunch that somehow there is a dependency introduced which normally supports bazel coverage. However it is picking up the target platform CPU instead of the host platform CPU.

@carpenterjc
Copy link
Author

cc_library - no failure
cc_test - Fails with toolchain resolution
cc_binary - no failure

@comius
Copy link
Contributor

comius commented Dec 9, 2022

This was most likely introduced by changing exec_constraints to target_constraints in Java tools. I believe behavior of 6.0.0 is more correct.

You can resolve the problem by adding default java toolchain for windows x86 to your WORKSPACE.

remote_java_repository(
    name = "remotejdk11_win_i686",
    exec_compatible_with = [
        "@platforms//os:windows",
        "@platforms//cpu:x86_32",
    ],
    sha256 = "421e03b0b70a515cb8e5994a6ceb86e7c5903c98383965c12a394d579ffc198b",
    strip_prefix = "zulu11.60.19-ca-jdk11.0.17-win_i686",
    urls = [
        "https://cdn.azul.com/zulu/bin/zulu11.60.19-ca-jdk11.0.17-win_i686.zip",
    ],
    version = "11",
)

I don't think we should add this by default to Bazel.

It's quite possible that the dependecies originate from coverage, if you don't have any other Java deps.

@carpenterjc
Copy link
Author

I can confirm we do not use Java, and we never use coverage, as there isn't support form MSVC and windows.

I can see this in the dependencies for a cc_test:

@remote_coverage_tools//:Main
@remote_coverage_tools//:all_lcov_merger_lib
@remote_coverage_tools//:all_lcov_merger_tools_deploy.jar
@remote_coverage_tools//:coverage_report_generator
@remote_coverage_tools//:lcov_merger

In this case I think there may be something wrong with the @remove_coverage_tools, because I would expect these tools to be built for the host system cfg = "exec" which in this case is intel x64.

I am reluctant to add a dependencies on rules_java and an extra jdk which are not used. It also looks like we now have to explicitly import rules_java because the built in load("@bazel_tools//tools/jdk:remote_java_repository.bzl", "remote_java_repository") complains that there is no exec_compatable_with.

@fmeum
Copy link
Collaborator

fmeum commented Dec 12, 2022

@comius I think I know what's wrong here, will submit a PR soon.

Edit: This changed with the cc_test starlarkification, so it is a behavioral change in Bazel 6.

@fmeum
Copy link
Collaborator

fmeum commented Dec 12, 2022

@bazel-io flag

@bazel-io bazel-io added the potential release blocker Flagged by community members using "@bazel-io flag". Should be added to a release blocker milestone label Dec 12, 2022
@carpenterjc
Copy link
Author

I found this issue, which may be adjacent. #15088

@meteorcloudy
Copy link
Member

@bazel-io fork 6.0.0

@bazel-io bazel-io removed the potential release blocker Flagged by community members using "@bazel-io flag". Should be added to a release blocker milestone label Dec 12, 2022
@comius comius added P2 We'll consider working on this in future. (Assignee optional) and removed P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) labels Dec 12, 2022
@comius
Copy link
Contributor

comius commented Dec 12, 2022

cc @c-mita

@comius
Copy link
Contributor

comius commented Dec 12, 2022

If this was introduced by cc_test Starlarkification, this is a regression we should fix. I don't consider it critical for first Bazel LTS release as it's possible to workaround.

@fmeum
Copy link
Collaborator

fmeum commented Dec 12, 2022

@comius I submitted a fix for the 6.0.0 regression (#16994). While I am at it, I will create a follow-up PR to fix #15088, but that is of course not a regression and the fix should not go into 6.0.0.

fmeum added a commit to fmeum/bazel that referenced this issue Dec 13, 2022
When coverage is disabled, `cc_test` should not depend on the Java LCOV merger tool. This is achieved by using `configuration_field`.

Also depend on coverage tools in `exec` rather than `target` configuration, matching Java rules as well as the once-per-build coverage report generator.

Fixes bazelbuild#16961

Closes bazelbuild#16994.

PiperOrigin-RevId: 494941601
Change-Id: Ie614de713b87bb66d869515676698f1a71cb106e
meteorcloudy pushed a commit that referenced this issue Dec 13, 2022
When coverage is disabled, `cc_test` should not depend on the Java LCOV merger tool. This is achieved by using `configuration_field`.

Also depend on coverage tools in `exec` rather than `target` configuration, matching Java rules as well as the once-per-build coverage report generator.

Fixes #16961

Closes #16994.

PiperOrigin-RevId: 494941601
Change-Id: Ie614de713b87bb66d869515676698f1a71cb106e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Rules-Java Issues for Java rules type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants