-
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_enable_cc_toolchain_resolution still tries to access local_config_cc #12712
Comments
FYI, @katre @gregestren, split from the other ticket. |
We encounters the same problem: whenever we want to cross-compile anything, with a platform mapping that doesn't map to host cpu(k8), I get the same error. Looks like the reference is from |
As a workaround, can you create a @oquenchil, can we make this check ignorable when toolchain resolution is enabled, or is it going to be necessary until we can flip the flag and remove the legacy code? |
That's what I ended up doing, but it didn't feel right. Hence the bug. |
Definitely a bug, I'm just glad to know there's a workaround if anyone hits this in the future. |
I have found you can delay setting the crosstool_top to the This is with Bazel 5.1 For example:
|
Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 14 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team ( |
@bazelbuild/triage please keep, this is still something that does not make sense |
This was possibly resolve with 0013115 @AustinSchuh could you verify and close? |
@comius , I can't tell for certain, but I think I'm getting worse errors now on bazel 7. They may be different, I can't tell easily. With both
You can see here that Bazel picks (I can probably persuade it to work with `--extra_toolchains or one of the other flags, but that seems like it leaves me at risk of accidentally getting the wrong toolchain somewhere else.) Any ideas? |
@AustinSchuh Do you have a reproducer you could share? On an empty project with just a single $ USE_BAZEL_VERSION=7.0.0rc4 bazel build //:lib --repo_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 --incompatible_enable_cc_toolchain_resolution --toolchain_resolution_debug=.*
INFO: Invocation ID: 5f1cf9a1-29a6-496e-bcf0-0e5a764647b9
WARNING: Build option --toolchain_resolution_debug has changed, discarding analysis cache (this can be expensive, see https://bazel.build/advanced/performance/iteration-speed).
INFO: ToolchainResolution: Target platform @@local_config_platform//:host: Selected execution platform @@local_config_platform//:host,
INFO: ToolchainResolution: Performing resolution of @@bazel_tools//tools/cpp:toolchain_type for target platform @@local_config_platform//:host
ToolchainResolution: No @@bazel_tools//tools/cpp:toolchain_type toolchain found for target platform @@local_config_platform//:host.
INFO: ToolchainResolution: Target platform @@local_config_platform//:host: Selected execution platform @@local_config_platform//:host,
ERROR: /home/fhenneke/.cache/bazel/_bazel_fhenneke/e9921a0e334967d7d44291dbeea196de/external/bazel_tools/tools/cpp/BUILD:58:19: in cc_toolchain_alias rule @@bazel_tools//tools/cpp:current_cc_toolchain:
Traceback (most recent call last):
File "/virtual_builtins_bzl/common/cc/cc_toolchain_alias.bzl", line 26, column 48, in _impl
File "/virtual_builtins_bzl/common/cc/cc_helper.bzl", line 219, column 17, in _find_cpp_toolchain
Error in fail: Unable to find a CC toolchain using toolchain resolution. Target: @@bazel_tools//tools/cpp:current_cc_toolchain, Platform: @@local_config_platform//:host, Exec platform: @@local_config_platform//:host which looks right to me: no toolchain from |
@AustinSchuh @comius Speculation here, but could this be because some rules have switched to building some tools rather than using pre-build binaries? |
I feel a bit embarrassed, but I'm having trouble reproducing the failure too. I'm getting this feeling like I somehow didn't add BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN like I thought I did... Thanks for digging in. |
Splitting off of #7260,
I flipped
--incompatible_enable_cc_toolchain_resolution
today with 4.0.0-rc7 (essentially), provided my own toolchains, removed the--crosstool_top
flag, and promptly got the following:We don't have an android or IOS build, so I would have thought I could flip it without waiting.
suggests that toolchain resolution succeeded, and the correct toolchains were selected. But, for some reason, the default
local_config_cc
is still being looked at, maybe because it is the default for--crosstool_top
or something like that. This ends up being a problem because I'm cross-compiling foraarch64
, andlocal_config_cc
isn't going to be able to find a compiler for that.The text was updated successfully, but these errors were encountered: