Configuring Tauri 2.0 for x86, x64 and arm64 cross-compilation
Wednesday, November 12, 2025
A while ago I discovered Tauri and I loved it. I think I still do. Since then they moved to version 2.0 and everything seems to work right off the bat.
In the meantime, I also got a new laptop - a Surface Laptop with and ARM processor. Mainly for the improved battery life but also because I'm curious about the future of Windows on ARM. Installing Tauri (or, more precisely, Rust) for ARM worked without a hitch. But of course, when I build an executable (or an MSI for setup) I'll end up with an ARM version. Researching Tauri for DepGraph, I had read about cross compilation in Rust, so I tried to figure out how to cross-compile a Tauri application for arm64, x86, and x64 on the same machine.
It turns out to be straightforward as soon as you find out how (Isn't it always?)
The first thing to realize is that compilation is done via Rust, and the rust compiler has the concept of a target. When you install Tauri and build your app with
npm run tauri build
it will by default create an executable in the src-tauri\target\release folder. This is the "default target". In my case, the app published there was an arm64 executable, since I installed Rust for arm64. (On Windows, the options on Rust's Getting Started page offer a version of rustup-init.exe for "32-bit", "x64", and "arm64"). The ducumentation says that you can build for other processors using the --target switch on tauri build, as in
tauri build --target x86_64-pc-windows-msvc
(This is the Windows x64 architecture). However, starting that from the command line produced an error, because the command 'tauri' could not be found. So I tried
npm run tauri build --target x86_64-pc-windows-msvc
But that didn't do at all what I needed:
npm warn Unknown env config "target". This will stop working in the next major version of npm.
and also:
error: unexpected argument 'x86_64-pc-windows-msvc' found
So we can't pass the arguments to tauri build this way. Some Googling suggested adding a double dash to make the extra arguments for tauri rather than npm itself, and some trial and error revealed that two double dashes always works, while a single set doesn't. So we have:
npm run tauri build -- -- --target x86_64-pc-windows-msvc
This now complained that the "target specification could not be loaded". The target needs to be installed first using rustup. To see which possible targets there are, run
rustup target list
It's a long list with some (for me) not very intuitive names. The ones you need for Windows (and the Visual Studio build tools) are:
- x86_64-pc-windows-msvc - this is x64
- i686-pc-windows-msvc - this is x86, i.e. 32-bit
- aarch64-pc-windows-msvc - this is arm64
To add a missing target, run for example
rustup target add x86_64-pc-windows-msvc
Building again with the npm-with-double-dashes command now works! The output is placed in the target-folder, but with an extra folder with the name of the target in between, so src-tauri\target\x86_64-pc-windows-msvc\release.
Now I have trouble remembering the exact target names (never mind that they're weird, what's "i686"?) so I modified package.json:
scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview",
"tauri": "tauri",
"build-arm64": "tauri build --target aarch64-pc-windows-msvc",
"build-x64": "tauri build --target x86_64-pc-windows-msvc",
"build-x86": "tauri build --target i686-pc-windows-msvc"
},
(This is where the --target switch was supposed to go in the first place I guess - oh well.) Using this configuation, I can now run one of
npm run tauri build-arm64
npm run tauri build-x64
npm run tauri build-x86
to build a specific target.
It may be that you need to install the correct Visual Studio Build Tools for Rust to work on all targets, but installing the Desktop C++ workload in Visual Studio 2026 on my ARM laptop installed them all for me. See the Tauri prerequisites.