On Apple silicon Macs, auto-detected host platform constraints' cpu is
aarch64, but arm64 is used everywhere else. This change ensures that you
will get the same cpu when your target depends on an arm64 or an aarch64
cpu contraint.
The bazel docs [1] currently recommend users to create an
`incompatible` constraint in their own code base. This constraint is
useful in expressing more advanced target compatibilities.
Currently every project has to create their own definition for this
constraint. That is unnecessary proliferation of something that can be
easily centralized here.
This patch makes it so users will be able to use the following pattern
in their BUILD files:
cc_library(
name = "unixish_lib",
srcs = "unixish_lib.cc",
target_compatible_with = select({
"@platforms//os:osx": [],
"@platforms//os:linux": [],
"//conditions:default": ["@platforms//:incompatible"],
],
)
[1]: https://docs.bazel.build/versions/master/platforms.html#skipping-incompatible-targets
This is commonly known thumbv6. However, it appears that the name
is split between armv6-m and thumbv6 globally. I choose the arm
notation in order to be consistent with the other arm platforms.
NixOS uses the Linux kernel, but that's where commonality with the
myriad Linux distributions out there stops. Like the different BSD's,
NixOS is sufficiently different that it warrants a constraint value.
In particular, no non-static binary has any chance of running on NixOS
unless it was specifically built for it, because the dynamic linker is
in a non-standard location. This means that toolchains downloaded as
part of host autoconfiguration that detect Linux (like
`go_register_toolchains()`) always fail on NixOS.
NixOS is a popular operating system used by thousands, one of the most
active projects on all of GitHub, and with more unique packages than
even Debian, Fedora or Gentoo according to https://repology.org/.
Copybara import of the project:
--
d74a52728a by Naren Dasan <naren@narendasan.com>:
Add QNX as a possible constraint value
Have been using bazel to compile for QNX, would like to see it as a constraint value.
END_PUBLIC
PiperOrigin-RevId: 278626573
Change-Id: If0c7ddbc8f5d26e4d9d43bf19933e901760d1564
*** Reason for rollback ***
Roll forward
*** Original change description ***
Automated rollback of commit e50397c444.
*** Reason for rollback ***
Breaks //third_party/arcore/unity/instant_preview/plugin/unity_plugin:unity_plugin_build_test_mac
[]
*** Original change description ***
Add Apple CPU and OS constraint values to bazel_platforms.
RELNOTES: None
PiperOrigin-RevId: 261704277
Change-Id: Id8a263c9258f448d402ae27cdf46576d6c7c8a49
*** Reason for rollback ***
Breaks //third_party/arcore/unity/instant_preview/plugin/unity_plugin:unity_plugin_build_test_mac
[]
*** Original change description ***
Add Apple CPU and OS constraint values to bazel_platforms.
RELNOTES: None
PiperOrigin-RevId: 260800549
Change-Id: I30f8caf94eb6fc9bd2fc37ce6c51b76dcd34e98e