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

bazel cquery fails on any objc_library rule due to missing toolchain for cpu darwin_x86_64 #16662

Open
shahms opened this issue Nov 4, 2022 · 1 comment
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Rules-ObjC Issues for Objective-C maintainers type: bug

Comments

@shahms
Copy link

shahms commented Nov 4, 2022

Description of the bug:

Given a BUILD file which includes any objc_library target, a cquery which would include that target will fail on any platform which doesn't include a cc_toolchain for darwin (and presumably the appropriate CPU).

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

Given the minimal BUILD file:

objc_library(
  name = "test_lib",
  srcs = ["test_lib.m"],
  # This is optional and doesn't change anything.
  target_compatible_with = ["@platforms//os:osx"],
)

Running:

$ bazel cquery //...
INFO: Build options --crosstool_top and --host_crosstool_top have changed, discarding analysis cache.
ERROR: external/local_config_cc/BUILD:47:19: in cc_toolchain_suite rule @local_config_cc//:toolchain: cc_toolchain_suite '@local_config_cc//:toolchain' does not contain a toolchain for cpu 'darwin_x86_64'
ERROR: external/local_config_cc/BUILD:47:19: Analysis of target '@local_config_cc//:toolchain' failed
ERROR: Analysis of target '//:test_lib' failed; build aborted:
INFO: Elapsed time: 0.225s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded, 261 targets configured)

Which operating system are you running Bazel on?

Linux Debian Rodete-based distribution

What is the output of bazel info release?

release 5.3.2

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 ?

This is a local minimal reproduction.

Have you found anything relevant by searching the web?

Nothing helpful, no.

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

No response

@keith
Copy link
Member

keith commented Oct 25, 2023

i think this is fixed with --incompatible_disable_objc_library_transition which is flipped at head, the build still won't work on linux ofc though, so you'll want that target_compatible_with still. related bazelbuild/apple_support#281

@keith keith added P2 We'll consider working on this in future. (Assignee optional) and removed untriaged labels Dec 18, 2023
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-ObjC Issues for Objective-C maintainers type: bug
Projects
None yet
Development

No branches or pull requests

3 participants