Skip to content

Commit

Permalink
Register apple cc toolchain (#2352)
Browse files Browse the repository at this point in the history
Bazel 7 stopped the Bazel in-built cc toolchain from knowing about Xcode
and the env vars it requires.

This change registers an Apple-aware cc toolchain, which will only be
used on macOS platforms.

Fixes #2207
  • Loading branch information
illicitonion authored Dec 22, 2023
1 parent 486553f commit ca8b624
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions examples/WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,12 @@ rbe_preconfig(
name = "buildkite_config",
toolchain = "ubuntu1804-bazel-java11",
)

load("@build_bazel_apple_support//crosstool:setup.bzl", "apple_cc_configure")

# As of Bazel 7, Bazel's bundled cc_toolchain only supports using CommandLineTools and not a full Xcode.
# This manifests itself if you try to use anything which requires access to $DEVELOPER_DIR, such as our bindgen example which non-hermetically tries to read libc++ headers from the system.
# On CI (and for some of our contributors), we have a full Xcode install, so this fails.
# We register the apple_support cc_toolchain here because it supports both CommandLineTools and full Xcodes.
# See https://github.com/bazelbuild/rules_rust/issues/2207 and https://github.com/bazelbuild/bazel/issues/20638
apple_cc_configure()

0 comments on commit ca8b624

Please sign in to comment.