Cross compiling Firefox for Windows ARM64

My napkin notes on cross compiling Firefox for Windows ARM64 (aarch64) on a x86 Windows host. Likely to be superseded by official instructions at some point (I'll add a note and a link when this happens), but for my and others reference in the mean time. These notes extend upon an already setup Windows build environment, so if you don't have that yet see here.

Before starting, make sure you have an up to date tool chain via mach bootstrap, an up to date versions of clang is important for the build.

I built with Windows 10 SDK (10.0.17763.0) installed (no others). This includes the SDK components for ARM and ARM64 apps. I didn't test with other SDKs – though I suspect older ones will work.

Setup a mozconfig for the build:

.mozconfig-aarch64, with contents

# ARM64 build
ac_add_options --target=aarch64

# Place build in specific dir
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../mozilla-builds/obj-ff-arm64-dbg-opt

Add the Visual C++ ATL for ARM64  and Visual C++ compilers and libraries for ARM64 to your VS2017 install via the Visual Studio Installer.

Set Rust tool chain to nightly: rustup default nightly. Add the required targets: rustup target add aarch64-pc-windows-msvc and rustup target add i686-pc-windows-msvc.

Build: MOZCONFIG=.mozconfig-aarch64 mach build.

Package the build into a zip: MOZCONFIG=.mozconfig-aarch64 mach package.

Now copy the firefox*.zip file from ../mozilla-builds/obj-ff-arm64-dbg-opt/dist to your target machine, extract, and the build should be good to go.