tauri: [bug] failed to cross compile `icons/icon.ico` into a Windows Resource tauri-build 2.0.0-alpha.4

Describe the bug

Basic example fails to cross compile for windows msvc with tauri = "2.0.0-alpha.8" and tauri-build = "2.0.0-aplha.4"

Caused by:
  process didn't exit successfully: `/project/target/release/build/app-a62c9b0b39a2abda/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-env-changed=TAURI_CONFIG
  cargo:rerun-if-changed=tauri.conf.json
  cargo:rustc-cfg=desktop
  cargo:rustc-env=TAURI_ANDROID_PACKAGE_PREFIX=fr_my_app
  cargo:rustc-env=TAURI_TARGET_TRIPLE=x86_64-pc-windows-msvc
  package.metadata does not exist
  failed to compile `icons/icon.ico` into a Windows Resource file during tauri-build: No such file or directory (os error 2)

It does work with tauri = "1.2" and tauri-build = "1.2"

In the error /project/target/release/build/app-a62c9b0b39a2abda/build-script-build would be expected to be /project/target/x86_64-pc-windows-msvc/release/build/app-a62c9b0b39a2abda/build-script-build. Looks like if the target is not correctly propagated somewhere.

Reproduction

No response

Expected behavior

No response

Platform and versions

platform: windows (cross compiled in a nix environment)

Stack trace

No response

Additional context

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 1
  • Comments: 24 (14 by maintainers)

Most upvoted comments

I would love to skip yet another fork (and if embed-resource works better, that’s awesome). If it fixes our problems I don’t see a reason for not taking it (and it seems well maintained, that’s weird 😂 )

But I know that we are using a clang toolchain not a gcc one, so I might need some more tweaking.

I do too, and the upcoming guide will ask users to do that too. That’s exactly why we forked winres, to support clang etc and not just gcc 😃

I had to apt install gcc-mingw-w64-x86-64

That’s a bit weird, binutils-mingw-w64 is supposed to contain both x86 and x64 but whatever, i’ll keep that in mind for the guide, thanks 😃

so I guess the issue must be in the changes made between the original crate and the fork.

The fork was made to support cross compilation (with the msvc toolchain) in the first place, upstream winres only support gnu on non-windows hosts. That said, it’s totally possible i messed something up, but i wasn’t able to repro this issue on my system so far.

Since you’re using msvc on unix i’d imagine you read this pr description? https://github.com/tauri-apps/tauri/pull/5788

If so, did you also scroll down to this comment https://github.com/tauri-apps/tauri/pull/5788#issuecomment-1372326440 which says you’ll also need to do sudo apt install binutils-mingw-w64 (or however you’d add that package in your env)

The same issue can be reproduced with the upcoming tauri-build = "1.3" (branch release/version-updates, commit 231c170276c2122cda30245cb012a7e6b1789ccd)