tauri icon indicating copy to clipboard operation
tauri copied to clipboard

[bug] TaskDialogIndirect issue when building Windows cross platform

Open minht11 opened this issue 1 year ago • 8 comments

Describe the bug

After compiling Tauri 2 Windows app cross platform. Launching it produces TaskDialogIndirect issue when building Windows cross platform

Reproduction

Create new Tauri 2 app. Try to build it on linux/macos with command:

cargo tauri build --runner cargo-xwin --target x86_64-pc-windows-msvc

After installing application you get error Entry point TaskDialogIndirect could not be located

If I build application on Windows it works fine, so only cross install is broken.

Expected behavior

No error when launching appllication on Windows.

Full tauri info output

[✔] Environment
    - OS: Mac OS 14.5.0 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.79.0 (129f3b996 2024-06-10)
    ✔ cargo: 1.79.0 (ffa9cf99a 2024-06-03)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: 1.79.0-aarch64-apple-darwin (environment override by RUSTUP_TOOLCHAIN)
    - node: 20.11.1
    - pnpm: 9.1.3
    - npm: 10.2.4

[-] Packages
    - tauri [RUST]: 2.0.0-beta.22
    - tauri-build [RUST]: 2.0.0-beta.17
    - wry [RUST]: 0.40.1
    - tao [RUST]: 0.28.1
    - tauri-cli [RUST]: 2.0.0-beta.20
    - @tauri-apps/api [NPM]: 2.0.0-beta.13
    - @tauri-apps/cli [NPM]: 2.0.0-beta.20

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../frontend/dist
    - devUrl: http://localhost:1420/

Stack trace

No response

Additional context

I was using guide from Tauri 1 https://tauri.app/v1/guides/building/cross-platform/#building-the-app I know it was bit outdated, but with some changes things compile successfully just don't run.

minht11 avatar Jul 01 '24 19:07 minht11

Thanks for the report! It still works fine for me when i'm building on WSL. Would it be possible to share a minimal reproduction repo that causes this issue for you? I'll try it out on my macbook too then :)

FabianLars avatar Jul 01 '24 20:07 FabianLars

I added reproduction https://github.com/minht11/tauri-TaskDialogIndirect-issue. I am using moon task runner to install additional cargo things, but that shouldn't be needed if you have them.

minht11 avatar Jul 02 '24 13:07 minht11

Hi sir @minht11 , any update for this?

khang3052002 avatar Jul 09 '24 15:07 khang3052002

Still an issue on latest RC.

minht11 avatar Sep 19 '24 08:09 minht11

I just tested it on macOS (from fresh following the guide) and i again had no issues :/

Maybe try again with latest llvm, latest cargo-xwin and cargo update ? Really not sure what to do without being able to repro it myself.

FabianLars avatar Sep 19 '24 21:09 FabianLars

I am experiencing this on Linux as well, to be absolutely sure we are running identical setups I made reproduction inside docker. https://github.com/minht11/tauri-cross-platform-issue-docker

  • Build docker image (will take a while). Inside it will compile Windows application.
  • Open built docker image filesystem and extract nsis executable.
  • Launch it on windows. See error.

I hope this helps reproducing issue on your end.

minht11 avatar Sep 24 '24 22:09 minht11

I am facing the same problem. I have looked at the following issue and tried adding an application manifest but it did not solve the problem. https://github.com/tauri-apps/tauri/issues/6732

festiva1300 avatar Sep 30 '24 13:09 festiva1300

I'm having the same problem. Also the icon is not set for the exe, so maybe windres is not called? I don't know how to debug it.

Update:

I had this problem when compilining with msvc. If I compile with gnu, the icon is set, but it can not find WebView2Loader.dll

Update 2:

The resource is missing. I did this to run the executable without error:

  1. Open exe with https://www.angusj.com/resourcehacker/
  2. Action -> Add using Script template -> Manifest
  3. Paste XML from https://docs.rs/tauri-build/latest/tauri_build/struct.WindowsAttributes.html#warning
  4. compile script template
  5. save file

Update 3:

Installing the fedora packages clang and llvm resolved it for me :partying_face:

elwerene avatar Oct 14 '24 11:10 elwerene

Thanks @elwerene I was struggling with a build&release GH action, and your comment saved me

cgtarmenta avatar Oct 27 '24 20:10 cgtarmenta

Thank you @elwerene . It works fine !

My Dockerfile:

FROM fedora:40

RUN dnf groupinstall -y "Development Tools" "Development Libraries"
RUN dnf install -y \
  curl \
  nodejs \
  pnpm \
  wget \
  file \
  webkit2gtk4.1-devel \
  libxdo-devel \
  openssl-devel \
  libayatana-appindicator-gtk3 \
  librsvg2-devel \
  mingw-nsis-base  \
  mingw32-nsis \
  lld \
  clang

ENV RUSTUP_HOME=/usr/local/rustup \
  CARGO_HOME=/usr/local/cargo \
  PATH=/usr/local/cargo/bin:$PATH

RUN export RUSTUP_HOME
RUN export CARGO_HOME
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path

RUN cargo install tauri-cli cargo-xwin --locked && \
    rustup target add x86_64-pc-windows-msvc

WORKDIR /app

COPY . .

RUN pnpm install

RUN cargo tauri build --runner cargo-xwin --target x86_64-pc-windows-msvc

festiva1300 avatar Oct 29 '24 15:10 festiva1300

@minht11 your docker example is missing apt-get install llvm. clang and lld is not enough because we need llvm-rc (llvm's resource compiler) to get the resource files into the exe.

FabianLars avatar Nov 04 '24 16:11 FabianLars