rfd icon indicating copy to clipboard operation
rfd copied to clipboard

0.9.0 fails to build on Windows 11 HOME

Open JoelMon opened this issue 3 years ago • 10 comments

Hello,

The latest, 0.9.0 version of rfd fails to build on Windows 11. I believe I'm building with 0.9.0 on a Linux system at home and there's no problem, I would have to check. The last version, 0.8.4 compiles fine on the same system that causes 0.9.0 to fail.

Build Environment

  • OS
    • Windows 11 Home Version 21H2
  • Rust
    • stable-x86_64-pc-windows-gnu unchanged - rustc 1.61.0 (fe5b13d68 2022-05-18)
    • stable-x86_64-pc-windows-msvc unchanged - rustc 1.61.0 (fe5b13d68 2022-05-18)
  • rfd
    • 0.9.0

Error

PS C:\Users\RFID\Desktop\Development\LISA> cargo build
   Compiling rfd v0.9.0
error: failed to run custom build command for `rfd v0.9.0`

Caused by:
  process didn't exit successfully: `C:\Users\RFID\Desktop\Development\LISA\target\debug\build\rfd-0842322a87b66bf1\build-script-build` (exit code: 101)
  --- stderr
  thread 'main' panicked at 'Couldn't to execute windres to compile "manifest.rc" into "C:\Users\RFID\Desktop\Development\LISA\target\debug\build\rfd-46a870fa0801e5af\out/libmanifest.a": program not found', C:\Users\RFID\.cargo\registry\src\github.com-1ecc6299db9ec823\embed-resource-1.7.2\src\windows_not_msvc.rs:34:23
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
PS C:\Users\RFID\Desktop\Development\LISA>

JoelMon avatar Jun 16 '22 18:06 JoelMon

Hi! Could you try with "common-controls-v6" feature flag disabled? (it's enabled by default), once default features are disabled you'll have to choose the Linux backend manually (gtk3 feature or xdg-portal)

PolyMeilex avatar Jun 16 '22 19:06 PolyMeilex

Also pinging @meowtec any ideas why windres binary would be missing or couldn't be executed?

PolyMeilex avatar Jun 16 '22 19:06 PolyMeilex

Could you try with "common-controls-v6" feature flag disabled? (it's enabled by default), once default features are disabled you'll have to choose the Linux backend manually (gtk3 feature or xdg-portal)

Not sure how to do that, would you be able to walk be though that?

JoelMon avatar Jun 17 '22 01:06 JoelMon

It seems like that windres is not found https://github.com/nabijaczleweli/rust-embed-resource/blob/e895286a9ac88c04d113a35dcc09cf615e32e405/src/windows_not_msvc.rs#L34 @JoelMon Do you have windres.exe in your environment?

@nabijaczleweli Could you take a look into this?

meowtec avatar Jun 17 '22 03:06 meowtec

Could you try with "common-controls-v6" feature flag disabled? (it's enabled by default), once default features are disabled you'll have to choose the Linux backend manually (gtk3 feature or xdg-portal)

Not sure how to do that, would you be able to walk be though that?

You can try to disable default features and add back gtk3 if you need it:

[dependencies]
rfd = { version = "0.9.0", default-features = false, features = ["gtk3"] }

For reference: https://doc.rust-lang.org/cargo/reference/features.html#dependency-features

meowtec avatar Jun 17 '22 03:06 meowtec

I have just tested msvc on Win11. I will try more targets

meowtec avatar Jun 17 '22 03:06 meowtec

I have just tested MSVC on Win11. Just now I also tested cross-compilation using cross build --target x86_64-pc-windows-gnu and it successed. I will try GNU on Win11 later.

meowtec avatar Jun 17 '22 03:06 meowtec

Maybe we should remove the resource-build code and leave it to be done by the user of rfd. They can choose either embed_resource or winres for embedding the manifest and avoid potential conflicts (for example, tauri already used winres for embedding other information). https://github.com/PolyMeilex/rfd/blob/76a4060fce349c0de6abd091389a89ae098debf0/build.rs#L17

meowtec avatar Jun 17 '22 03:06 meowtec

Maybe we should remove the resource-build code and leave it to be done by the user of rfd. They can choose either embed_resource or winres for embedding the manifest and avoid potential conflicts (for example, tauri already used winres for embedding other information).

https://github.com/PolyMeilex/rfd/blob/76a4060fce349c0de6abd091389a89ae098debf0/build.rs#L17

Sure, sounds good to me, as long as it is nicely documented/or has an example in the repo

PolyMeilex avatar Jun 17 '22 09:06 PolyMeilex

I wasn't able to test it this Friday at work but FYI I didn't have all the VS C++ build tools installed. I had to install them when compiling code from the emilk/egui repository.

Monday I'll test:

  • attempt to run the code with VS C++ build tools installed
  • follow the steps above

JoelMon avatar Jun 18 '22 12:06 JoelMon