tauri-apps / tauri

Build smaller, faster, and more secure desktop and mobile applications with a web frontend.
https://tauri.app
Apache License 2.0
84.36k stars 2.54k forks source link

[bug] Cross-platform compilation from linux to Windows doesn't work #10647

Open Razzwan opened 2 months ago

Razzwan commented 2 months ago

Describe the bug

Cross-platform compilation does not work:

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

The script keeps giving an error:

warning 5202: -OUTPUTCHARSET is disabled for non Win32 platforms.
    Error failed to bundle project:
    - `Invalid cross-device link (os error 18)

Reproduction

  1. Linux debian:bookworm-slim

  2. Create a fresh project as discribed here https://v2.tauri.app/start/create-project/

  3. Install required packages as described here https://tauri.app/v1/guides/getting-started/prerequisites#1-system-dependencies and here https://tauri.app/v1/guides/building/cross-platform#experimental-build-windows-apps-on-linux-and-macos

  4. Try to build Windows .exe file from linux using script cargo tauri build --ci --runner cargo-xwin --target x86_64-pc-windows-msvc

Expected behavior

Build must be successfully created

Full tauri info output

[✔] Environment
     - OS: Debian 12.0.0 X64
     ✔ webkit2gtk-4.1: 2.44.2
     ✔ rsvg2: 2.54.7
     ✔ rustc: 1.80.1 (3f5fd8dd4 2024-08-06)
     ✔ cargo: 1.80.1 (376290515 2024-07-16)
     ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
     ✔ Rust toolchain: 1.80.1-x86_64-unknown-linux-gnu (environment override by RUSTUP_TOOLCHAIN)
     - node: 18.19.0
     - npm: 9.2.0

 [-] Packages
     - tauri [RUST]: 2.0.0-rc (no lockfile)
     - tauri-build [RUST]: no manifest (no lockfile)
     - wry [RUST]: no manifest (no lockfile)
     - tao [RUST]: no manifest (no lockfile)
     - tauri-cli [RUST]: 2.0.0-rc.3
     - @tauri-apps/api [NPM]: 2.0.0-rc.0
     - @tauri-apps/cli [NPM]: 2.0.0-rc.3

 [-] App
     - build-type: bundle
     - CSP: unset
     - frontendDist: ../dist
     - devUrl: http://localhost:1420/
     - framework: React
     - bundler: Vite

### Stack trace

```text
Running makensis.exe to produce /app/src-tauri/target/x86_64-pc-windows-msvc/release/bundle/nsis/myapp.x.x.x_x64-setup.exe
 warning 5202: -OUTPUTCHARSET is disabled for non Win32 platforms.
     Error failed to bundle project:
     - `Invalid cross-device link (os error 18)`

Additional context

  1. The Linux build runs correctly and works as expected, which is great
  2. I am using rust 1.80.1 and also checked manually, that TMPDIR=/var/tmp (as was discussed here - https://github.com/tauri-apps/tauri/issues/4500).
FabianLars commented 2 months ago

Am i understanding it correctly that this is running inside a docker container? If not, how is the path /app/... ?

If it is docker, then i have to admit that i did not test the instructions in that environment yet.

It probably won't give us more info, but can you re-run it with the --verbose flag and post the full logs?

Razzwan commented 2 months ago

Yes, you are correct. It is inside Docker container.

I will try it with --verbose and will let you ASAP