Skip to content

Commit 9227203

Browse files
committed
Swift: print a helpful message on macOS ARM
Also remove the tentative way compilation was expected to be fixed on macOS ARM without really working. In the future we will create universal binaries (which requires compiling our prebuilt package for ARM as well), but until then we must require the developer to pass `--cpu=darwin_x86_64` to the build command when building on an ARM macOS platform like the M1. This will be printed out explicitly now if it's not the case.
1 parent 7f6b400 commit 9227203

File tree

2 files changed

+10
-17
lines changed

2 files changed

+10
-17
lines changed

swift/rules.bzl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@ def _wrap_cc(rule, kwargs):
55
_add_args(kwargs, "copts", [
66
# Required by LLVM/Swift
77
"-fno-rtti",
8-
] + select({
9-
# temporary, before we do universal merging and have an arm prebuilt package, we make arm build x86
10-
"@platforms//os:macos": ["-arch=x86_64"],
11-
"//conditions:default": [],
12-
}))
8+
])
139
_add_args(kwargs, "features", [
1410
# temporary, before we do universal merging
1511
"-universal_binaries",

swift/tools/prebuilt/BUILD.bazel

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
11
package(default_visibility = ["//swift:__subpackages__"])
22

33
#TODO we will be introducing universal binaries at a later stage, when we have both architectures prebuilt for macOS
4-
# for the moment, we make arm build an x86_64 binary
5-
_arch_override = {
6-
"darwin_arm64": "darwin_x86_64",
7-
}
8-
4+
# for the moment, we require --cpu=darwin_x86_64 on an ARM macOS
95
[
106
alias(
117
name = name,
12-
actual = select({
13-
"@bazel_tools//src/conditions:%s" % arch: "@swift_prebuilt_%s//:%s" % (
14-
_arch_override.get(arch, arch),
15-
name,
16-
)
17-
for arch in ("linux", "darwin_x86_64", "darwin_arm64")
18-
}),
8+
actual = select(
9+
{
10+
"@bazel_tools//src/conditions:%s" % arch: "@swift_prebuilt_%s//:%s" % (arch, name)
11+
for arch in ("linux", "darwin_x86_64")
12+
},
13+
no_match_error = "Unsupported platform. Support for the ARM macOS platform is still a todo, " +
14+
"please pass --cpu=darwin_x86_64 for the time being",
15+
),
1916
)
2017
for name in ("swift-llvm-support", "swift-test-sdk")
2118
]

0 commit comments

Comments
 (0)