Skip to content

Commit b4b0c32

Browse files
meteorcloudycopybara-github
authored andcommitted
Fix unix toolchain for macos arm64 platform
This allow the basic unix toolchain to work on Apple silicon without Xcode installed. Fixes #13514 Closes #13515. PiperOrigin-RevId: 375711139
1 parent b018ea1 commit b4b0c32

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

tools/cpp/cc_configure.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def cc_autoconf_impl(repository_ctx, overriden_tools = dict()):
122122
configure_windows_toolchain(repository_ctx)
123123
elif (cpu_value.startswith("darwin") and
124124
("BAZEL_USE_CPP_ONLY_TOOLCHAIN" not in env or env["BAZEL_USE_CPP_ONLY_TOOLCHAIN"] != "1")):
125-
configure_osx_toolchain(repository_ctx, overriden_tools)
125+
configure_osx_toolchain(repository_ctx, cpu_value, overriden_tools)
126126
else:
127127
configure_unix_toolchain(repository_ctx, cpu_value, overriden_tools)
128128

tools/cpp/osx_cc_configure.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def _compile_cc_file(repository_ctx, src_name, out_name):
8383
"https://github.com/bazelbuild/bazel/issues with the following:\n" +
8484
error_msg)
8585

86-
def configure_osx_toolchain(repository_ctx, overriden_tools):
86+
def configure_osx_toolchain(repository_ctx, cpu_value, overriden_tools):
8787
"""Configure C++ toolchain on macOS.
8888
8989
Args:
@@ -187,4 +187,4 @@ def configure_osx_toolchain(repository_ctx, overriden_tools):
187187
},
188188
)
189189
else:
190-
configure_unix_toolchain(repository_ctx, cpu_value = "darwin", overriden_tools = overriden_tools)
190+
configure_unix_toolchain(repository_ctx, cpu_value, overriden_tools = overriden_tools)

tools/cpp/unix_cc_configure.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ def configure_unix_toolchain(repository_ctx, cpu_value, overriden_tools):
331331
)
332332

333333
repository_ctx.file("tools/cpp/empty.cc", "int main() {}")
334-
darwin = cpu_value == "darwin"
334+
darwin = cpu_value.startswith("darwin")
335335

336336
cc = _find_generic(repository_ctx, "gcc", "CC", overriden_tools)
337337
is_clang = _is_clang(repository_ctx, cc)

0 commit comments

Comments
 (0)