Open mendrik opened 12 months ago
face the same issue
So, i got this report from 3 people (unless one of you also talked with me about it on discord) and i tried to reproduce it on 10 machines in various states (fresh install to 5 years in use) and i can't reproduce it whatever i try.
To my understanding this can only realistically happen if rust compiles for/with the gnu toolchain since it's guarded with conditional compilation cfg flags that act according to the target env: https://github.com/nabijaczleweli/rust-embed-resource/blob/master/src/lib.rs#L131-L134
I don't know, please make sure your toolchain set to msvc rustup default stable-msvc
and that there is nothing that overwrites the target (btw, you can get a list of installed targets via rustup show
, to check if you have the gnu target installed), like via .cargo/config.toml
configurations.
Btw, cross compiling from the msvc windows toolchain to the gnu one or the other way around are not supported by rust-embed-resource, so if you want to compile to the msvc target you have to use the msvc toolchain (officially supported), and if you want to compile for the gnu target you have to use the gnu toolchain (not supported but should work if your msys installation has binutils installed for the resource compiler).
I encountered the same issue, which was due to using the GNU toolchain. I resolved it by switching to MSVC following these steps:
@FabianLars
What can I do if I have to use gnu rust compiler in msys2?
After I added resources to my program tauri uses it with embed-resource
and I receive the error
--- stderr
windres: preprocessing failed.
thread 'main' panicked at C:/msys64/ucrt64/.cargo\registry\src\index.crates.io-6f17d22bba15001f\embed-resource-2.4.1\src\windows_not_msvc.rs:48:25:
windres failed to compile "C:\msys64\home\User\vibe\target\release\build\vibe-desktop-fc91fca7c7de9867\out\resource.rc" into "C:\msys64\home\User\vibe\target\release\build\vibe-desktop-fc91fca7c7de9867\out/libresource.a" with exit code: 1
I have dependency which can compile on windows only with gnu compiler of rust in the project vibe
Btw, before adding this resources I made this script which worked for me. I'm wondering if it can help
https://github.com/nabijaczleweli/rust-embed-resource/issues/65
@thewh1teagle Can you open a new issue or discussion for this? Your error seems to be different. Also please include this file in that issue/discussion "C:\msys64\home\User\vibe\target\release\build\vibe-desktop-fc91fca7c7de9867\out\resource.rc"
(the random string may change on each build so get it from the error message)
p.s. i never tried the ucrt64 packages, only the mingw64 ones, so i can't give you a guarantee ucrt64 works 🤷
I encountered the same issue, which was due to using the GNU toolchain. I resolved it by switching to MSVC following these steps:
- Uninstall Rust and any existing Visual Studio on the computer, and delete the '.rustup' folder in the user directory.
- Restart the computer.
- Download 'Visual C++ Build Tools' from (https://visualstudio.microsoft.com/visual-cpp-build-tools/) and install it (select 'C++ Desktop Development').
- Restart the computer (recommended).
- Install Rust using 'rustup-init.exe' (choose 1 - Proceed with installation (default)).
- Restart the computer (recommended)."
The issue was not resolved for me. T_T Note: I am using Windows 10
In my case I had another version of rust installed via choco. I realized that upon looking into the .rustc_info.json file in the target directory, because under "stdout" it showed that it was using gnu instead of msvsc as the toolchain. So consider checking if you are using the wrong toolchain
I found the solution from here(https://github.com/rust-lang/rust/issues/91146#issuecomment-1556081181
I found the solution from here(rust-lang/rust#91146 (comment)
Please! How to install it and how to solve it?
I found the solution from here(rust-lang/rust#91146 (comment)我从这里找到了解决方案( rust-lang/rust#91146 (comment)
Please! How to install it and how to solve it?请!如何安装以及如何解决?
Download the UCRT runtime from here (https://winlibs.com/#download-release ), extract it, and add the bin directory to the environment variables. Remember to remove the environment variables for other C/C++ compilers first.
I'm not sure if this will be helpful for you, but after making these changes, I was able to successfully build the program.
Describe the bug
C:\Desk\mendrik\gridmail [(master)]> pnpm tauri dev
VITE v4.5.0 ready in 1527 ms
➜ Local: http://localhost:1420/ ➜ Network: use --host to expose Info Watching C:\Desk\mendrik\gridmail\src-tauri for changes... Compiling gridmail v0.0.0 (C:\Desk\mendrik\gridmail\src-tauri) error: failed to run custom build command for
gridmail v0.0.0 (C:\Desk\mendrik\gridmail\src-tauri)
Caused by: process didn't exit successfully:
C:\Desk\mendrik\gridmail\src-tauri\target\debug\build\gridmail-c6d3a36e1f6fd448\build-script-build
(exit code: 101) --- stdout cargo:rerun-if-env-changed=TAURI_CONFIG cargo:rerun-if-changed=tauri.conf.json cargo:rustc-cfg=desktop cargo:rustc-cfg=dev package.metadata does not exist--- stderr thread 'main' panicked at C:\Users\andre.cargo\registry\src\index.crates.io-6f17d22bba15001f\embed-resource-2.4.0\src\windows_not_msvc.rs:49:23: Couldn't to execute windres to compile "C:\Desk\mendrik\gridmail\src-tauri\target\debug\build\gridmail-7730a8fa1494b3ce\out\resource.rc" into "C:\Desk\mendrik\gridmail\src-tauri\target\debug\build\gridmail-7730a8fa1494b3ce\out/libresource.a": program not found note: run with
RUST_BACKTRACE=1
environment variable to display a backtrace ELIFECYCLE Command failed with exit code 4294967295. ELIFECYCLE Command failed with exit code 101.Reproduction
Well I followed the readme, step by step and got this when I chose preact + typescript
Expected behavior
It should probably launch a window.
Platform and versions
Stack trace
Additional context
No response