I want to build a Tauri app on Windows for the Rust target x86_64-pc-windows-gnu. I can't use the MSVC target because my app will depend on several dlls that are compiled with MinGW, and I can't recompile them for MSVC because a dependency requires gfortran.
Reproduce
My environment:
- MinGW from https://github.com/niXman/mingw-builds-binaries/releases/download/13.1.0-rt_v11-rev1/x86_64-13.1.0-release-posix-seh-ucrt-rt_v11-rev1.7z
- LLVM installed
Create a template tauri app:
A:\repo\tauri-gnu-windows-2>npm create tauri-app@latest
✔ Project name · tauri-gnu-windows-2
✔ Choose which language to use for your frontend · TypeScript / JavaScript - (pnpm, yarn, npm)
✔ Choose your package manager · npm
✔ Choose your UI template · React - (https://reactjs.org/)
✔ Choose your UI flavor · TypeScript
Run cd tauri-gnu-windows-2 and npm install. Then run npm run tauri -- dev --target x86_64-pc-windows-gnu. This error occurs:
Compiling tauri-gnu-windows-2 v0.0.0 (A:\repo\tauri-gnu-windows-2\tauri-gnu-windows-2\src-tauri)
Compiling webview2-com v0.19.1
error: linking with `x86_64-w64-mingw32-gcc` failed: exit code: 1
|
= note: "x86_64-w64-mingw32-gcc" "-fno-use-linker-plugin" "-Wl,--dynamicbase" "-Wl,--disable-auto-image-base" "-m64" "-Wl,--high-entropy-va"
...
"-nodefaultlibs" "A:\\repo\\tauri-gnu-windows-2\\tauri-gnu-windows-2\\src-tauri\\target\\x86_64-pc-windows-gnu\\debug\\build\\tauri-gnu-windows-2-bf5a16e02a5fa2bb\\out/resource.lib" "C:\\Users\\Home\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsend.o"
= note: A:\repo\tauri-gnu-windows-2\tauri-gnu-windows-2\src-tauri\target\x86_64-pc-windows-gnu\debug\build\tauri-gnu-windows-2-bf5a16e02a5fa2bb\out/resource.lib: file not recognized: file format not recognized
collect2.exe: error: ld returned 1 exit status
error: could not compile `tauri-gnu-windows-2`