-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
incompatible_use_cc_configure_from_rules_cc: Use cc_configure from @rules_cc #10134
Comments
…les_cc Will be used when --incompatible_use_cc_configure_from_rules_cc is implemented. I'm adding the empty implementation so Bazel release has the symbol so out internal tests pass when the flag is not flipped. Progress towards #10134. PiperOrigin-RevId: 279756806
In this cl only add the flag. Installing the calls to __do_not_use_fail_with_incompatible_use_cc_configure_from_rules_cc will be done in a followup cl. Progress towards #10134. RELNOTES: None. PiperOrigin-RevId: 280649623
…_tools Progress towards #10134. RELNOTES: None. PiperOrigin-RevId: 280654359
Bazel docs here points to this issue for migration instructions but I don't see any migration instructions here. Any idea when those will be posted? I encountered this issue in bazelbuild/rules_docker#1354 when attempting to cross compile a Go binary with CGO using rules_go on Linux for Mac. FYI @jayconrod |
make ``` bazel build //tensorflow/tools/pip_package:build_pip_package ```` work again on aarch64 (e.g., EdgeTPU Dev board and Jetson boards) and arm (e.g, Raspberry Pi 3/4 boards) Linux platforms without this patch, I saw ``` ... ERROR: While resolving toolchains for target //tensorflow:libtensorflow_framework.so.2.1.0: 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 bazelbuild/bazel#10134 for details and migration instructions. ERROR: Analysis of target '//tensorflow/tools/pip_package:build_pip_package' failed; build aborted: 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 bazelbuild/bazel#10134 for details and migration instructions. ```
make ``` bazel build //tensorflow/tools/pip_package:build_pip_package ```` work again on aarch64 (e.g., EdgeTPU Dev board and Jetson boards) and arm (e.g, Raspberry Pi 3/4 boards) Linux platforms without this patch, I saw ``` ... ERROR: While resolving toolchains for target //tensorflow:libtensorflow_framework.so.2.1.0: 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 bazelbuild/bazel#10134 for details and migration instructions. ERROR: Analysis of target '//tensorflow/tools/pip_package:build_pip_package' failed; build aborted: 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 bazelbuild/bazel#10134 for details and migration instructions. ```
cc @oquenchil |
@hlopko Note the bazel source code refers users to this issue for migration instructions, and as @smukherj1 has pointed out, the migration instructions are still a TODO despite the flag being flipped in 3.0.0. |
Hi, I'm looking at the code and it seems this wasn't flipped in 3.0.0. The top comment here does say that it will be flipped in 3.0.0 but that did not happen as far as I can tell. Before I update the comment, please let me know if this was really flipped and I'm just not seeing it. |
Any fix for Mac? On Rhel it works.
|
The flag wasn't flipped as far as I can tell nor will it be flipped any time soon. |
You can ignore this incompatible flag. I believe --all_incompatible_changes will also be removed. @aiuto weren't there plans to do that? |
I think the problem is that users have broken their C++ compiler (such that bazel can't find it), and in that case they receive an error message with a hyperlink to this issue, so they assume this is where to find their salvation. It's most likely just a red herring, though. |
For others arriving from the error message and looking to debug: If others landing here find that to be the right next step, maybe we should add it to the error message. Maybe give a 👍🏻 if that's you, so we can gauge usefulness? |
If you came here because you trying to build go containers with rules_docker package, add os and arch explicitly to your go_image declaration Then you should delete old cache and rebuild |
Hey, all! I tossed up a quick PR (#15135), proposing the changes that it seemed like people wanted above! Andrey's message above brought me back to this issue, and I saw the reacts, above. Would love your help getting it (or an alternative) through! |
Hi @systemlogic, where you able to solve this issue? I am seeing similar issue with M1. |
For anyone running into this issue on an Apple Silicon machine. Here is how I managed to solve it.
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# Go (necessary to avoid issue described in this thread)
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "io_bazel_rules_go",
sha256 = "16e9fca53ed6bd4ff4ad76facc9b7b651a89db1689a2877d6fd7b82aa824e366",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.34.0/rules_go-v0.34.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.34.0/rules_go-v0.34.0.zip",
],
)
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
go_rules_dependencies()
go_register_toolchains(version = "1.18.3")
# Docker (setup as described in rules_docker repo example)
http_archive(
name = "io_bazel_rules_docker",
sha256 = "b1e80761a8a8243d03ebca8845e9cc1ba6c82ce7c5179ce2b295cd36f7e394bf",
urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.25.0/rules_docker-v0.25.0.tar.gz"],
)
load(
"@io_bazel_rules_docker//repositories:repositories.bzl",
container_repositories = "repositories",
)
container_repositories()
load("@io_bazel_rules_docker//repositories:deps.bzl", container_deps = "deps")
container_deps()
load("@io_bazel_rules_docker//container:container.bzl", "container_pull")
container_pull(
name = "alpine_linux_arm64",
digest = "sha256:9b2a28eb47540823042a2ba401386845089bb7b62a9637d55816132c4c3c36eb",
registry = "index.docker.io",
repository = "library/alpine",
# tag field is ignored since digest is set
tag = "latest",
)
load("@io_bazel_rules_docker//container:container.bzl", "container_image")
container_image(
name = "basic_alpine",
base = "@alpine_linux_arm64//image",
cmd = ["Hello World!"],
entrypoint = ["echo"],
) |
This helped solve the issue with go. But now it has spawned another issue with |
rules_go v0.34.0 gave me the error mentioned by harsh, but v0.33.0 worked fine. I've filed bazel-contrib/rules_go#3269 in that repository. However, based on the age of this issue, I'm guessing that some people may have been facing a different root cause. |
I'm getting this error on FreeBSD 13.1 to run "hello world" C++ example:
What is causing the issue? Thanks. |
Unfortunately, it seems like there are a number of possible root causes for this error. The first thing I would try is to make sure common build tools are installed on your system (e.g. gcc, g++). If I'm not mistaken, Bazel doesn't come packaged with these and relies on them being present in the host environment. |
Here's a very simple repo on Mac OS X: WORKSPACE
BUILD
src/fun/aryeh/HelloWorld.java
Error
|
If you come to this issue because of trying to build a docker image for language that doesn't have platform specific builds from a non Linux machine (IE java, python, etc) you should add @abhillman I believe this is what you're running into. |
I solved this issue by registering zig toolchains inspired by this Under WORKSPACE:
|
## What is the goal of this PR? We downgrade `rules_go` from `0.35.0` to `0.34.0` (in `@vaticle_dependencies`), fixing an issue in C++ toolchain resolution on Apple Silicon. ## What are the changes implemented in this PR? `bazel build //...` would fail on Apple Silicon with an error resolving the Go toolchain (for use in `rules_docker`). We tried deleting `rules_go`, which seemed reasonable given we don't use Go anywhere, but this caused a different error in C++ toolchain resolution. (We believe `rules_docker` uses Go for cross-compilation of images.) The exact cause of this issue remains unclear, but proves quite straightforward to fix: we downgrade `rules_go` from `0.35.0` to `0.34.0` in `@vaticle_dependencies`, following advice from bazelbuild/bazel#10134 (comment) , quoted below: For anyone running into this issue on an Apple Silicon machine. Here is how I managed to solve it. `WORKSPACE` ```bzl load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") # Go (necessary to avoid issue described in this thread) load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "io_bazel_rules_go", sha256 = "16e9fca53ed6bd4ff4ad76facc9b7b651a89db1689a2877d6fd7b82aa824e366", urls = [ "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.34.0/rules_go-v0.34.0.zip", "https://github.com/bazelbuild/rules_go/releases/download/v0.34.0/rules_go-v0.34.0.zip", ], ) load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") go_rules_dependencies() go_register_toolchains(version = "1.18.3") # Docker (setup as described in rules_docker repo example) http_archive( name = "io_bazel_rules_docker", sha256 = "b1e80761a8a8243d03ebca8845e9cc1ba6c82ce7c5179ce2b295cd36f7e394bf", urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.25.0/rules_docker-v0.25.0.tar.gz"], ) ``` _Originally posted by @gillesmag in bazelbuild/bazel#10134 (comment) This is definitely a workaround more than an actual fix, but it works and is consistent and predictable.
Flag:
--incompatible_use_cc_configure_from_rules_cc
Introduced in: 1.2
Will be flipped: not anytime soon AFAIK
Description
We are moving
cc_configure
, the logic that automatically configures C++ toolchain for the host machine, to@rules_cc
.Migration
TODO
The text was updated successfully, but these errors were encountered: