tauri icon indicating copy to clipboard operation
tauri copied to clipboard

[bug] Error failed to bundle project: Architecture Error: `unsupported target: aarch64`

Open infinitepower18 opened this issue 2 years ago • 13 comments

Describe the bug

Trying to build for Windows ARM64 using the instructions provided here. But end up getting an error message saying aarch64 is an unsupported target.

Reproduction

  1. In the project directory run the command npm run tauri build -- -t aarch64-pc-windows-msvc

Expected behavior

ARM64 should have been built successfully.

Platform and versions

Environment › OS: Windows 10.0.22621 X64 › Webview2: 106.0.1370.52 › MSVC: - Visual Studio Community 2022 › Node.js: 16.17.1 › npm: 8.19.2 › pnpm: Not installed! › yarn: Not installed! › rustup: 1.25.1 › rustc: 1.64.0 › cargo: 1.64.0 › Rust toolchain: stable-x86_64-pc-windows-msvc

Packages › @tauri-apps/cli [NPM]: 1.1.1 › @tauri-apps/api [NPM]: Not installed! › tauri [RUST]: 1.1.1, › tauri-build [RUST]: 1.1.1, › tao [RUST]: 0.14.0, › wry [RUST]: 0.21.1,

App › build-type: bundle › CSP: unset › distDir: ../ui › devPath: ../ui

App directory structure ├─ .git ├─ .github ├─ node_modules ├─ src-tauri └─ ui

Stack trace

C:\Users\Ahnaf\Desktop\randomnumber-tauri>npm run tauri build -- -t aarch64-pc-windows-msvc

> tauri
> tauri build -t aarch64-pc-windows-msvc

   Compiling proc-macro2 v1.0.47
   Compiling quote v1.0.21
   Compiling unicode-ident v1.0.5
   Compiling syn v1.0.103
   Compiling autocfg v1.1.0
   Compiling cfg-if v1.0.0
   Compiling serde_derive v1.0.147
   Compiling serde v1.0.147
   Compiling ppv-lite86 v0.2.16
   Compiling siphasher v0.3.10
   Compiling getrandom v0.1.16
   Compiling memchr v2.5.0
   Compiling log v0.4.17
   Compiling proc-macro-hack v0.5.19
   Compiling parking_lot_core v0.9.4
   Compiling windows-tokens v0.39.0
   Compiling thiserror v1.0.37
   Compiling serde_json v1.0.87
   Compiling windows_aarch64_msvc v0.42.0
   Compiling winapi v0.3.9
   Compiling ryu v1.0.11
   Compiling itoa v1.0.4
   Compiling strsim v0.10.0
   Compiling fnv v1.0.7
   Compiling ident_case v1.0.1
   Compiling windows_x86_64_msvc v0.42.0
   Compiling smallvec v1.10.0
   Compiling convert_case v0.4.0
   Compiling new_debug_unreachable v1.0.4
   Compiling once_cell v1.15.0
   Compiling byteorder v1.4.3
   Compiling scopeguard v1.1.0
   Compiling windows_aarch64_msvc v0.39.0
   Compiling precomputed-hash v0.1.1
   Compiling bitflags v1.3.2
   Compiling mac v0.1.1
   Compiling dtoa v0.4.8
   Compiling tinyvec_macros v0.1.0
   Compiling utf-8 v0.7.6
   Compiling regex-syntax v0.6.27
   Compiling crc32fast v1.3.2
   Compiling windows_x86_64_msvc v0.39.0
   Compiling matches v0.1.9
   Compiling version_check v0.9.4
   Compiling itoa v0.4.8
   Compiling alloc-no-stdlib v2.0.4
   Compiling nodrop v0.1.14
   Compiling stable_deref_trait v1.2.0
   Compiling typenum v1.15.0
   Compiling percent-encoding v2.2.0
   Compiling thin-slice v0.1.1
   Compiling windows-metadata v0.39.0
   Compiling unicode-bidi v0.3.8
   Compiling semver v1.0.14
   Compiling lazy_static v1.4.0
   Compiling crossbeam-utils v0.8.12
   Compiling anyhow v1.0.66
   Compiling windows_aarch64_msvc v0.36.1
   Compiling heck v0.4.0
   Compiling glob v0.3.0
   Compiling bytes v1.2.1
   Compiling adler32 v1.2.0
   Compiling cty v0.2.2
   Compiling libc v0.2.137
   Compiling unicode-segmentation v1.10.0
   Compiling adler v1.0.2
   Compiling windows_aarch64_msvc v0.37.0
   Compiling tao v0.14.0
   Compiling bytemuck v1.12.1
   Compiling color_quant v1.1.0
   Compiling uuid v0.8.2
   Compiling cpufeatures v0.2.5
   Compiling futures-core v0.3.25
   Compiling tauri-runtime v0.11.1
   Compiling native-tls v0.2.10
   Compiling futures-task v0.3.25
   Compiling wry v0.21.1
   Compiling encoding_rs v0.8.31
   Compiling pin-project-lite v0.2.9
   Compiling http-range v0.1.5
   Compiling futures-util v0.3.25
   Compiling tauri-runtime-wry v0.11.1
   Compiling rfd v0.10.0
   Compiling base64 v0.13.1
   Compiling fastrand v1.8.0
   Compiling pin-utils v0.1.0
   Compiling num_cpus v1.13.1
   Compiling state v0.5.3
   Compiling getrandom v0.2.8
   Compiling instant v0.1.12
   Compiling phf_shared v0.8.0
   Compiling phf_shared v0.10.0
   Compiling lock_api v0.4.9
   Compiling num-traits v0.2.15
   Compiling num-integer v0.1.45
   Compiling num-iter v0.1.43
   Compiling num-rational v0.4.1
   Compiling slab v0.4.7
   Compiling tokio v1.21.2
   Compiling futf v0.1.5
   Compiling fxhash v0.2.1
   Compiling tinyvec v1.6.0
   Compiling dtoa-short v0.3.3
   Compiling thread_local v1.1.4
   Compiling alloc-stdlib v0.2.2
   Compiling servo_arc v0.1.1
   Compiling form_urlencoded v1.1.0
   Compiling generic-array v0.14.6
   Compiling deflate v0.7.20
   Compiling inflate v0.3.4
   Compiling raw-window-handle v0.5.0
   Compiling tauri v1.1.1
   Compiling miniz_oxide v0.5.4
   Compiling windows-bindgen v0.39.0
   Compiling http v0.2.8
   Compiling heck v0.3.3
   Compiling cfb v0.6.1
   Compiling rand_core v0.6.4
   Compiling uuid v1.2.1
   Compiling tendril v0.4.3
   Compiling brotli-decompressor v2.3.2
   Compiling unicode-normalization v0.1.22
   Compiling rand_chacha v0.3.1
   Compiling infer v0.7.0
   Compiling rand_core v0.5.1
   Compiling aho-corasick v0.7.19
   Compiling bstr v0.2.17
   Compiling quick-xml v0.23.1
   Compiling windows-sys v0.42.0
   Compiling flate2 v1.0.24
   Compiling crossbeam-channel v0.5.6
   Compiling windows-sys v0.36.1
   Compiling brotli v3.3.4
   Compiling windows v0.37.0
   Compiling idna v0.3.0
   Compiling rand v0.8.5
   Compiling rand_pcg v0.2.1
   Compiling rand_chacha v0.2.2
   Compiling winapi-util v0.1.5
   Compiling regex v1.6.0
   Compiling dirs-sys-next v0.1.2
   Compiling remove_dir_all v0.5.3
   Compiling os_pipe v1.1.1
   Compiling shared_child v1.0.0
   Compiling filetime v0.2.18
   Compiling png v0.17.6
   Compiling crypto-common v0.1.6
   Compiling block-buffer v0.10.3
   Compiling rand v0.7.3
   Compiling phf_generator v0.10.0
   Compiling schannel v0.1.20
   Compiling open v3.0.3
   Compiling same-file v1.0.6
   Compiling dirs-next v2.0.0
   Compiling tempfile v3.3.0
   Compiling globset v0.4.9
   Compiling parking_lot v0.12.1
   Compiling tar v0.4.38
   Compiling digest v0.10.5
   Compiling string_cache_codegen v0.5.2
   Compiling walkdir v2.3.2
   Compiling phf_generator v0.8.0
   Compiling darling_core v0.13.4
   Compiling image v0.24.4
   Compiling png v0.11.0
   Compiling sha2 v0.10.6
   Compiling ignore v0.4.18
   Compiling phf_codegen v0.8.0
   Compiling ico v0.1.0
   Compiling markup5ever v0.10.1
   Compiling selectors v0.22.0
   Compiling phf_macros v0.8.0
   Compiling windows-implement v0.39.0
   Compiling cssparser v0.27.2
   Compiling thiserror-impl v1.0.37
   Compiling html5ever v0.25.2
   Compiling cssparser-macros v0.6.0
   Compiling derive_more v0.99.17
   Compiling phf_macros v0.10.0
   Compiling ctor v0.1.26
   Compiling webview2-com-macros v0.6.0
   Compiling strum_macros v0.22.0
   Compiling futures-macro v0.3.25
   Compiling serialize-to-javascript-impl v0.1.1
   Compiling serde_repr v0.1.9
   Compiling darling_macro v0.13.4
   Compiling phf v0.8.0
   Compiling windows v0.39.0
   Compiling phf v0.10.1
   Compiling darling v0.13.4
   Compiling strum v0.22.0
   Compiling serde_with_macros v1.5.2
   Compiling string_cache v0.8.4
   Compiling serde_with v1.14.0
   Compiling url v2.3.1
   Compiling toml v0.5.9
   Compiling serde_urlencoded v0.7.1
   Compiling os_info v3.5.1
   Compiling treediff v3.0.2
   Compiling attohttpc v0.22.0
   Compiling serialize-to-javascript v0.1.1
   Compiling cargo_toml v0.11.8
   Compiling winres v0.1.12
   Compiling webview2-com-sys v0.19.0
   Compiling json-patch v0.2.6
   Compiling kuchiki v0.8.1
   Compiling tauri-utils v1.1.1
   Compiling tauri-codegen v1.1.1
   Compiling tauri-build v1.1.1
   Compiling tauri-macros v1.1.1
   Compiling app v0.1.0 (C:\Users\Ahnaf\Desktop\randomnumber-tauri\src-tauri)
   Compiling tauri-winrt-notification v0.1.0
   Compiling notify-rust v4.5.10
   Compiling webview2-com v0.19.1
    Finished release [optimized] target(s) in 3m 17s
       Error failed to bundle project: Architecture Error: `unsupported target: aarch64`

Additional context

No response

infinitepower18 avatar Oct 27 '22 20:10 infinitepower18

Oof that's my bad, i think i had the bundler disabled when i wrote the guide...

The latest stable wix release (2019) doesn't support arm and i'm not sure if we should even look into the development builds :/

FabianLars avatar Oct 27 '22 20:10 FabianLars

I wanted to build one of my apps for an ARM64 Surface and did a little digging.

It looks like the wix4 toolset is where the active development is happening. There was a second preview release last month, but it's been over a year since the first preview release, so I don't know when a full release is expected.

Meanwhile, they added ARM64 support in a development version of wix3 (https://github.com/wixtoolset/issues/issues/5558) but never made it an official release for wix3. The binaries from https://wixtoolset.org/docs/v3/releases/v3-14-0-6526/ should include support, and then the bundler would probably need to map aarch64 to arm64 in /tooling/bundler/src/bundle/windows/msi/wix.rs.

The downside is we'd need to be OK with taking a dependency on the development build until wix4 is ready and we have a chance to migrate to that.

wravery avatar Dec 05 '22 16:12 wravery

We probably will just use NSIS and either deprecate WiX or completely remove it in v2.

amrbashir avatar Dec 06 '22 01:12 amrbashir

BTW, while it does fail to build the install package, I found the executable in /src-tauri/target/aarch64-pc-windows-msvc/release and it worked fine when I copied it manually to the ARM64 device.

wravery avatar Dec 06 '22 02:12 wravery

Is there a way to disable the WiX build, even if it results in a less-than-ideal UX for ARM64 users? If not, what's the next best way to get tauri-action to succeed when building ARM64 apps for Windows?

Edit: Found it! --bundles none produces an exe without bundling into an MSI.

dstaley avatar Jan 09 '23 02:01 dstaley

Can someone with a native windows arm system test if this installer works? I don't care about the app inside, just the installer. tauri-app_0.0.0_arm64-setup.exe.zip

FabianLars avatar Jan 11 '23 15:01 FabianLars

Tested it on a Windows ARM64 VM on my M1 Pro MBP, works fine.

Screenshot 2023-01-11 at 6 54 13 pm

infinitepower18 avatar Jan 11 '23 18:01 infinitepower18

Cool, thank you!

Edit: to clarify. The setup is actually x86 and requires emulation to work. Unfortunately nsis can't be compiled to a native arm exe so we have to keep depending on emulation. The installed app itself is native arm64 nonetheless! p.s. this is also how electron-builder's nsis target works. i could imagine that Squirrel.Windows used by electron-forge has the same limitation since it's quite old too but i didn't check that yet.

FabianLars avatar Jan 11 '23 18:01 FabianLars

@FabianLars if the installer is always going to be x86, that means you could make a universal installer that installs an x86/x64 version or an ARM64 version based on the host's architecture type (similar to how the universal target works for Apple). I'd love to see that as an option in lieu of separate x64 and ARM64 installers.

dstaley avatar Jan 12 '23 01:01 dstaley

Yeah i like that idea and saw that in electron-builder too i think.

FabianLars avatar Jan 12 '23 08:01 FabianLars

@FabianLars the results of the test you did above were done on tauri master? Or was it a branch? I'm looking to compile an app to Windows ARM too.

Having an universal installer would be awesome, but I wouldn't mind separate installers for now.

goenning avatar Jan 15 '23 11:01 goenning

It was a local change, but a really small one. i'll push it today.

FabianLars avatar Jan 15 '23 11:01 FabianLars

https://github.com/tauri-apps/tauri/pull/6070 You can try it out with cargo install tauri-cli --git https://github.com/tauri-apps/tauri --branch nsis-arm64 && cargo tauri build/cargo tauri build --target aarch64-pc-windows-msvc (note that you need to install additional stuff if you're on x86)

Testing the resulting installer on arm64 systems is appreciated :v:

FabianLars avatar Jan 15 '23 19:01 FabianLars

Im not sure if this is related, but I have got an existing Tauri project for windows, I wanted to try to run it locally and tried running it on a Windows 11 ARM VM on my M1 Pro MBP. After installing all dependencies the npm run tauri dev and npm run tauri build commands fail with this error

image

Any idea how I can get past these?

kush-daga avatar Mar 06 '23 13:03 kush-daga

tldr of the discord discussion about the error message above: there are no pre-built binaries for windows on arm because the ring crate can't be compiled for that platform yet (they do support it on git, but it's not released yet)

FabianLars avatar Mar 06 '23 13:03 FabianLars

ARM64 seems to be working via nsis now.

infinitepower18 avatar May 07 '23 17:05 infinitepower18

I have successfully built my app for ARM64 on Windows using /tauri build --config src-tauri/tauri.release.conf.json --target aarch64-pc-windows-msvc --bundles nsis

But I have not updater file along the build with warn message:

Finished release [optimized] target(s) in 0.41s Warn The updater is enabled but the bundle target list does not contain updater, so the updater artifacts won't be generated.

@FabianLars do you know if there a way to add updater files to ARM64 on Windows nsis bundle ?

kurdin avatar Apr 13 '24 00:04 kurdin

@kurdin instead of --bundles nsis do --bundles nsis,updater

FabianLars avatar Apr 13 '24 06:04 FabianLars