tauri-apps / plugins-workspace

All of the official Tauri plugins in one place!
https://tauri.app
Apache License 2.0
917 stars 254 forks source link

[shell] Can't build 2.0.0-beta3 for Windows 32-Bit #1046

Closed podarcis closed 7 months ago

podarcis commented 7 months ago

In our project (Windows 32-Bit support needed, i686-pc-windows-msvc) we updated from 2.0.0-beta0 to 2.0.0-beta3 (both versions 2.0.0-beta1 and 2.0.0-beta2 did not compile in the combination with other Tauri deps). 64-Bit x86_64-pc-windows-msvc however builds just fine.

The build process aborts with the MSVC linker giving this error message (unresolved external symbol) when trying to link ShellExecuteW for libopen:

  = note: libopen-694a3dd32f5061c1.rlib(open-694a3dd32f5061c1.open.5c851ecd4378e97c-cgu.0.rcgu.o) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp__ShellExecuteW" in Funktion "__ZN4open7windows13ShellExecuteW17h190ca8d6aadc8784E".
          c:\tauri-app\src-tauri\target\debug\deps\tauri_app.exe : fatal error LNK1120: 1 nicht aufgelöste Externe

I noticed that with #1021 the dependency of crate open was raised from major version 4 to 5. Maybe this is related. I'm unsure whether this is an issue of the shell plugin or with the open crate.

This is reproducible with a fresh Tauri2-beta.

$ yarn tauri info
yarn run v1.22.21
$ tauri info

[✔] Environment
    - OS: Windows 10.0.19044 X64
    ✔ WebView2: 122.0.2365.66
    ✔ MSVC: Visual Studio Build Tools 2022
    ✔ rustc: 1.76.0 (07dca489a 2024-02-04)
    ✔ cargo: 1.76.0 (c84b36747 2024-01-18)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: stable-i686-pc-windows-msvc (default)
    - node: 20.10.0
    - pnpm: 8.15.4
    - yarn: 1.22.21
    - npm: 10.2.3

[-] Packages
    - tauri [RUST]: 2.0.0-beta.9
    - tauri-build [RUST]: 2.0.0-beta.7
    - wry [RUST]: 0.37.0
    - tao [RUST]: 0.26.1
    - @tauri-apps/api [NPM]: 2.0.0-beta.4
    - @tauri-apps/cli [NPM]: 2.0.0-beta.7

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
    - framework: Vue.js
    - bundler: Vite
Done in 11.19s.
amrbashir commented 7 months ago

This is the same as https://github.com/Byron/open-rs/pull/91#issuecomment-1974905927, could you share the repo or a minimal repro where this issue happens as I am unable to reproduce.

podarcis commented 7 months ago

@amrbashir

This is the same as Byron/open-rs#91 (comment),

Yes, I also just found this issue and it mentioned exactly the same.

could you share the repo or a minimal repro where this issue happens as I am unable to reproduce.

Unfortunately I can't share I can't share the main application repo. But as I said it's reproducible using the current Tauri beta. I'll try to list the steps for reproduction (see my tauri info for the other environment info; basically it's a Windows 10 x86_64 machine building for i686):

$ rustup default
stable-i686-pc-windows-msvc (default)

$ rustup toolchain list
stable-i686-pc-windows-msvc (default)     # This is the only toolchain that is installed

$ rustup target list --installed
i686-pc-windows-msvc                  # This is the only target that is installed

$ yarn create tauri-app --beta        # Fresh Tauri 2 beta

$ yarn tauri dev --target i686-pc-windows-msvc

I'll try in another machine/setup and test if it behaves the same.

amrbashir commented 7 months ago

Thank you, I think I have found the problem. Will open a PR upstream.

amrbashir commented 7 months ago

Opened a PR here: https://github.com/Byron/open-rs/pull/93

you can try the fix by adding the following patch inside Cargo.toml:

[patch.crates-io]
open = { git = "https://github.com/tauri-apps/amrbashir", branch = "fix/shell-execute-w-link" }

then do cargo update inside src-tauri

podarcis commented 7 months ago

I can confirm that it's fixed in your branch. Looking forward to your PR getting merged upstream.

Thanks for the fast fix!

amrbashir commented 7 months ago

The PR has been merged and released, you can remove the patch and just do cargo update and it should be fixed.