From bb5926b3291877fb47d44ea376881c2d52701bbf Mon Sep 17 00:00:00 2001 From: Martin Robinson Date: Mon, 26 Aug 2024 22:30:43 -0700 Subject: [PATCH] mach: Do not manually install toolchain for non-cross builds (#33190) * mach: Do not manually install toolchain for non-cross builds This fixes the Apple Silicon build where the installed toolchain does not match the host triple. We only install toolchains manually for cross builds, because cargo and friends will do this automatically when executing. Signed-off-by: Martin Robinson * fix lints Signed-off-by: Mukilan Thiyagarajan --------- Signed-off-by: Martin Robinson Signed-off-by: Mukilan Thiyagarajan Co-authored-by: Mukilan Thiyagarajan --- python/servo/command_base.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/python/servo/command_base.py b/python/servo/command_base.py index 016022c6c41..01dac1ca7fb 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -799,16 +799,20 @@ class CommandBase(object): return servo.platform.get().passive_bootstrap() + self.context.bootstrapped = True - needs_toolchain_install = self.target.triple() not in \ - check_output(["rustup", "target", "list", "--installed"], - cwd=self.context.topdir).decode() - if needs_toolchain_install: + # Toolchain installation is handled automatically for non cross compilation builds. + if not self.target.is_cross_build(): + return + + installed_targets = check_output( + ["rustup", "target", "list", "--installed"], + cwd=self.context.topdir + ).decode() + if self.target.triple() not in installed_targets: check_call(["rustup", "target", "add", self.target.triple()], cwd=self.context.topdir) - self.context.bootstrapped = True - def ensure_rustup_version(self): try: version_line = subprocess.check_output(