rules_docker icon indicating copy to clipboard operation
rules_docker copied to clipboard

Py3_image no matching toolchains for types @bazel_tools//tools/cpp:toolchain_type

Open GeorgeEngland opened this issue 4 years ago • 6 comments

🐞 bug report

Affected Rule

The issue is caused by the rule: py3_image

Description

I can build a basic py_binary. But when building the py3_image we get:

🔬 Minimal Reproduction

Use default RBE 16-04 config and build a py3_image

🔥 Exception or Error



INFO: Invocation ID: a1d17661-a555-4223-a240-9dc43240e075
INFO: ToolchainResolution: Removed execution platform //configs/config:platform from available execution platforms, it is missing constraint @io_bazel_rules_docker//platforms:run_in_container
INFO: ToolchainResolution: Removed execution platform @local_config_platform//:host from available execution platforms, it is missing constraint @io_bazel_rules_docker//platforms:run_in_container
INFO: ToolchainResolution: Removed execution platform //configs/config:platform from available execution platforms, it is missing constraint @io_bazel_rules_docker//platforms:run_in_container
INFO: ToolchainResolution: Target platform //configs/config:platform: Selected execution platform //configs/config:platform,
INFO: ToolchainResolution: Removed execution platform //configs/config:platform from available execution platforms, it is missing constraint @io_bazel_rules_docker//platforms:run_in_container
INFO: ToolchainResolution: Removed execution platform @local_config_platform//:host from available execution platforms, it is missing constraint @io_bazel_rules_docker//platforms:run_in_container
INFO: ToolchainResolution: Removed execution platform //configs/config:platform from available execution platforms, it is missing constraint @io_bazel_rules_docker//platforms:run_in_container
ERROR: While resolving toolchains for target XXXX:py_image.binary: 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.

Operating System: Ubuntu container (remote), ubuntu container local

GeorgeEngland avatar Oct 07 '21 07:10 GeorgeEngland

Our toolchain also uses gcc rather than clang

GeorgeEngland avatar Oct 07 '21 08:10 GeorgeEngland

Temporary fix: Removed --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 from .bazelrc

GeorgeEngland avatar Oct 07 '21 18:10 GeorgeEngland

I've encountered the same issue while attempting to use Bazel again; however, I'm not even using a .bazelrc with options like BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN in the setup described by @GeorgeEngland. I've created a repo that makes the issue easily reproducible with Docker.

Perhaps these tool versions are not compatible? Any recommendations for a version combo that currently works? Or is there something else wrong in the example repo that causes this issue?

  • Ubuntu 20.04 w/ python and python3 installed
  • Bazelisk w/ 4.2.1 in .bazeliskrc
  • rules_python-0.5.0 w/ pip_parse for dependencies and py3_image
  • rules_docker-v0.21.0

kriswuollett avatar Nov 19 '21 23:11 kriswuollett

Resolved my instance of this issue by noticing I was missing the following in my WORKSPACE:

load("@io_bazel_rules_docker//python3:image.bzl", _py_image_repos = "repositories")
_py_image_repos()

I've updated my example repo to show the working example.

kriswuollett avatar Nov 20 '21 00:11 kriswuollett

Facing the same issue on Bazel 5.0.0

esirK avatar Mar 11 '22 06:03 esirK

Had the same issue on Bazel 5.2.0 and solve it by adding --@io_bazel_rules_docker//transitions:enable=false to the command

jensenkairos avatar Jun 30 '22 15:06 jensenkairos

Related https://github.com/bazelbuild/bazel/issues/10134

abhillman avatar Oct 08 '22 20:10 abhillman

This issue has been automatically marked as stale because it has not had any activity for 180 days. It will be closed if no further activity occurs in 30 days. Collaborators can add an assignee to keep this open indefinitely. Thanks for your contributions to rules_docker!

github-actions[bot] avatar Apr 07 '23 02:04 github-actions[bot]

This issue was automatically closed because it went 30 days without a reply since it was labeled "Can Close?"

github-actions[bot] avatar May 07 '23 02:05 github-actions[bot]