Cannot use target_compatible_with to ignore MacOS only targets
See original GitHub issueDescription of the problem:
I’m trying to use the target_compatible_with
attribute to automatically skip MacOS only targets on other platforms, but I just get an error every time. I have a simple objc_library
rule with target_compatible_with = [ "@platforms//os:macos" ]
but whenever I run bazel build //...:all
on non MacOS platforms I get this:
ERROR: /root/.cache/bazel/_bazel_root/eab0d61a99b6696edb3d2aff87b585e8/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: Analysis of target '//ble/platform/macos:ble_macos' failed; build aborted: Analysis of target '@local_config_cc//:toolchain' failed
Bugs: what’s the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Any objc_library
rule fails instead of being ignored.
objc_library(
name = 'ble',
target_compatible_with = [
"@platforms//os:macos",
],
)
I added a simple example here: jagobagascon/bazel-target-compatible
It’s just an empty objc_library
rule but you can se how the Ubuntu build fails while the MacOS just works: jagobagascon/bazel-target-compatible/actions/runs/512144112
What operating system are you running Bazel on?
I’m running it on a Docker image based on ubuntu:focal-20200423
, but it also happens on a GitHub-hosted ubuntu-18.04
.
What’s the output of bazel info release
?
release 4.0.0
Issue Analytics
- State:
- Created 3 years ago
- Comments:30 (27 by maintainers)
Top Results From Across the Web
Platforms | Bazel
Use the target_compatible_with attribute to tell Bazel what target platform constraints your code has. The simplest use of this attribute ...
Read more >Use your iMac as a display with target display mode
Target display mode is a feature available with certain older Mac models. The following older iMac models can be used as an external...
Read more >Everything You Need to Know About Deployment Targets
You need to understand what a deployment target is if you plan to develop for iOS (and iPadOS), tvOS, macOS, or watchOS. In...
Read more >How to Set Up a New Mac: Should You Migrate or Do a Clean ...
If you use wi-fi, with Macs running macOS Sierra or later, Migration Assistant creates a peer-to-peer wi-fi network to transfer files. If either ......
Read more >Save disk space with OneDrive Files On-Demand for Mac
When you're connected to the internet, you'll be able to use online-only files like every other file on your device. Important: Files On-Demand...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sorry for dropping the ball on this ticket. It’s been a busy few months. I’m resuming work on this at the end of August.
If anyone else wants to take it over in the meantime, I can totally understand that.
Thanks for the update! Happy to provide any more feedback as needed!