Cross compiling Firefox for Windows ARM64
1 min read

Cross compiling Firefox for Windows ARM64

Updated 2021-08, to reflect current steps. The original steps are preseved following the updated instructions.

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.

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

I built with Windows SDK 10.0.18362.0 installed. On top of the normal Firefox build steps I also installed MSVC v142 - VS 2019 C++ ARM64 build tools (latest) and C++ ATL for latest v142 build tools (ARM64) via the Visual Studio Installer (for a VS 2019 install).

Add the aarch64 windows target to Rust with rustup target add aarch64-pc-windows-msvc. This works on stable and, I assume, on nightly Rust.

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.

These are the instructions from the original post. The same mozconfig is used as above, and the same mach commands are used. These instructions may still work, but I'd suggest using the ones above as they require less steps.

Get build env setup and use mozconfig as above.

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.

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.

Run mach build and package commands as above.