blob: dd3984e58d2b802c5f5a93d38cd6dc2f9fa3bbde [file] [log] [blame] [view]
Avi Drissmanab7729b2021-06-10 19:17:151# Chromium for Arm Macs
Nico Webera4ea04f62020-07-08 17:20:452
Nico Weberf169d962021-05-16 13:21:263This document describes the state of Chromium on Apple Silicon Macs.
Nico Weberd7c855c162022-04-08 15:28:404The short summary is that almost everything works, without needing Rosetta.
Nico Webera4ea04f62020-07-08 17:20:455
Nico Weber80140882022-01-05 19:24:556There's a [main waterfall
7bot](https://ci.chromium.org/p/chromium/builders/ci/mac-arm64-rel)
Bruce Dawsonc2661722024-06-12 19:44:298that builds for Arm. It cross-builds on an x86-64 machine.
Nico Weber6a0eef62c2020-09-19 00:33:079
Nico Weber80140882022-01-05 19:24:5510There's a [main waterfall
11bot](https://ci.chromium.org/p/chromium/builders/ci/mac-arm64-on-arm64-rel)
Nico Weberd7c855c162022-04-08 15:28:4012that builds for Arm on an Arm bot as well. This bot does not have Rosetta
13installed.
Nico Weber80140882022-01-05 19:24:5514
Nico Weber6a0eef62c2020-09-19 00:33:0715There's also a [tester
Zhaoyang Li5d3713d2022-06-13 18:01:1716bot](https://ci.chromium.org/p/chromium/builders/ci/mac12-arm64-rel-tests)
Nico Weberd7c855c162022-04-08 15:28:4017that continuously runs tests. Most tests pass. The tester bots don't
18have Rosetta installed.
19
20ASan builds do not yet work ([tracking bug](https://crbug.com/1271140))
Nico Weber6a0eef62c2020-09-19 00:33:0721
Avi Drissmanab7729b2021-06-10 19:17:1522## Building _for_ Arm Macs
Nico Webera4ea04f62020-07-08 17:20:4523
Avi Drissmanab7729b2021-06-10 19:17:1524If you are on an Intel Mac, all that's required to build Chromium for arm64
25is to add a `target_cpu = "arm64"` line to your `args.gn`. Then build normally.
26If you are on an Arm Mac, your build will by default be an Arm build, though
27please see the section below about building _on_ Arm Macs for specific things
28to keep in mind.
Nico Webera4ea04f62020-07-08 17:20:4529
Avi Drissmanab7729b2021-06-10 19:17:1530A note about copying a Chromium build to your Arm Mac. If you don't do a
31component build (e.g. a regular `is_debug=false` build), you can just copy
32over Chromium.app from your build directory. If you copy it using
Nico Weber6a0eef62c2020-09-19 00:33:0733macOS's "Shared Folder" feature and Finder, Chromium.app should be directly
34runnable. If you zip, upload Chromium.app to some web service and download
Avi Drissmanab7729b2021-06-10 19:17:1535it to an Arm Mac, browsers will set the `com.apple.quarantine` bit, which will
36cause the Finder to say `"Chromium" is damanged and can't be opened. You should
Nico Weber6a0eef62c2020-09-19 00:33:0737move it to the Trash."`. In Console.app, the kernel will log
38`kernel: Security policy would not allow process: 2204,
39/Users/you/Downloads/Chromium.app/Contents/MacOS/Chromium` and amfid will log
40`amfid: /Users/you/Downloads/Chromium.app/Contents/MacOS/Chromium signature not
41valid: -67050`. To fix this, open a terminal and run
42
43 % cd ~/Downloads && xattr -rc Chromium.app
44
45After that, it should start fine.
46
47As an alternative to building locally, changes can be submitted to the opt-in
Zhaoyang Li5d3713d2022-06-13 18:01:1748[mac12-arm64-rel
49trybot](https://ci.chromium.org/p/chromium/builders/try/mac12-arm64-rel). A small
Nico Weber6a0eef62c2020-09-19 00:33:0750number of [swarming bots](https://goto.corp.google.com/run-on-dtk) are also
51available for Googlers to run tests on.
52
Avi Drissmanab7729b2021-06-10 19:17:1553Arm Mac-specific bugs are tagged with the
54[Mac-ARM64 label](https://crbug.com/?q=label%3Amac-arm64).
Nico Weber6a0eef62c2020-09-19 00:33:0755
Mark Mentovai33fa9d72020-11-12 16:13:2456### Universal Builds
57
Nico Webera1acc7d2021-04-06 23:55:4158A “universal” (or “fat”) `.app` can be created from distinct x86\_64 and arm64
Mark Mentovai33fa9d72020-11-12 16:13:2459builds produced from the same source version. Chromium has a `universalizer.py`
60tool that can then be used to merge the two builds into a single universal
61`.app`.
62
63 % ninja -C out/release_x86_64 chrome
64 % ninja -C out/release_arm64 chrome
65 % mkdir out/release_universal
66 % chrome/installer/mac/universalizer.py \
67 out/release_x86_64/Chromium.app \
68 out/release_arm64/Chromium.app \
69 out/release_universal/Chromium.app
70
71The universal build is produced in this way rather than having a single
72all-encompassing `gn` configuration because:
73
74 - Chromium builds tend to take a long time, even maximizing the parallelism
75 capabilities of a single machine. This split allows an additional dimension
Nico Webera1acc7d2021-04-06 23:55:4176 of parallelism by delegating the x86\_64 and arm64 build tasks to different
Mark Mentovai33fa9d72020-11-12 16:13:2477 machines.
Nico Webera1acc7d2021-04-06 23:55:4178 - During the mac-arm64 bring-up, the x86\_64 and arm64 versions were built
79 using different SDK and toolchain versions. When using the hermetic SDK and
Mark Mentovai33fa9d72020-11-12 16:13:2480 toolchain, a single version of this package must be shared by an entire
81 source tree, because it’s managed by `gclient`, not `gn`. However, as of
82 November 2020, Chromium builds for the two architectures converged and are
83 expected to remain on the same version indefinitely, so this is now more of a
84 historical artifact.
85
86## Building _on_ arm Macs
Nico Webera4ea04f62020-07-08 17:20:4587
Nico Weber80140882022-01-05 19:24:5588It's possible to build _on_ an arm Mac, without Rosetta. This
89configuration is covered by a [main waterfall
90bot](https://ci.chromium.org/p/chromium/builders/ci/mac-arm64-on-arm64-rel).
Nico Webera4ea04f62020-07-08 17:20:4591
Takuto Ikuta7478af722024-05-27 07:23:1992Checking out and building (with reclient too) should just work.
Nico Weberf169d962021-05-16 13:21:2693You should be able to run `fetch chromium` normally, and then build, using
94`gn`, `ninja` etc like normal.
Nico Webera1acc7d2021-04-06 23:55:4195
Nico Weber80140882022-01-05 19:24:5596Building Chrome/Mac/Intel on an arm Mac currently needs a small local tweak
97to work, see [tracking bug](https://crbug.com/1280968).
98
Nico Weberd7c855c162022-04-08 15:28:4099All tests should build, run, and mostly pass.