Skip to content

Commit c47e5ef

Browse files
danakjAravind Vasudevan
authored andcommitted
Don't pass --build aarch64-mac-darwin when using --build-mac-arm
--build should refer to the actual current machine as a triple, not to the host we want to build a compiler for. This fixed the mac arm build. [email protected] Bug: 1386212 Change-Id: Id81a9de25532fc93c0751a953391d88d4955753a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4375377 Commit-Queue: danakj <[email protected]> Reviewed-by: Hans Wennborg <[email protected]> Cr-Commit-Position: refs/heads/main@{#1123109} NOKEYCHECK=True GitOrigin-RevId: a595321c67f0060856e36f6f6514f9794e85d7b0
1 parent 3649005 commit c47e5ef

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

build_rust.py

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,18 @@ def GetLatestRustCommit():
501501
return main['commit']
502502

503503

504+
def RustTargetTriple(build_mac_arm):
505+
if sys.platform == 'darwin':
506+
if platform.machine() == 'arm64' or build_mac_arm:
507+
return 'aarch64-apple-darwin'
508+
else:
509+
return 'x86_64-apple-darwin'
510+
elif sys.platform == 'win32':
511+
return 'x86_64-pc-windows-msvc'
512+
else:
513+
return 'x86_64-unknown-linux-gnu'
514+
515+
504516
# Fetch or build the LLVM libraries, for the host machine and when
505517
# cross-compiling for the target machine.
506518
#
@@ -634,15 +646,8 @@ def main():
634646
else:
635647
checkout_revision = RUST_REVISION
636648

637-
if sys.platform == 'darwin':
638-
if platform.machine() == 'arm64' or args.build_mac_arm:
639-
host_triple = 'aarch64-apple-darwin'
640-
else:
641-
host_triple = 'x86_64-apple-darwin'
642-
elif sys.platform == 'win32':
643-
host_triple = 'x86_64-pc-windows-msvc'
644-
else:
645-
host_triple = 'x86_64-unknown-linux-gnu'
649+
building_on_host_triple = RustTargetTriple(False)
650+
building_for_host_triple = RustTargetTriple(args.build_mac_arm)
646651

647652
args.gcc_toolchain = None
648653
if sys.platform.startswith('linux'):
@@ -705,9 +710,12 @@ def main():
705710
else:
706711
assert not rest
707712

708-
xpy_args = ['--build', host_triple]
713+
xpy_args = ['--build', building_on_host_triple]
709714
if args.build_mac_arm:
710-
xpy_args.extend(['--host', host_triple, '--target', host_triple])
715+
xpy_args.extend([
716+
'--host', building_for_host_triple, '--target',
717+
building_for_host_triple
718+
])
711719

712720
if not args.skip_clean:
713721
print('Cleaning build artifacts...')

0 commit comments

Comments
 (0)