rend3: Panic in new version when cross-compiled to Windows.

Existing program using new Rend3, rev = “6dd847f”, works when built on LInux with a Linux target, but if built for a cross-compiled Windows target, crashes under Wine 7.0. This program worked cross platform with version rev = “a972b0ff0a98bb79b2b1c8812e3a823840a5e02e”

Reproduce by:

git clone https://github.com/John-Nagle/ui-mock.git
cd ui-mock
cargo build --target x86_64-pc-windows-gnu --examples

cd to x86 target dir wine ui-mock.exe

wine ui-mock.exe

0104:err:ntlm:ntlm_LsaApInitializePackage no NTLM support, expect problems
Proj dirs data local dir: "C:\\users\\john\\Local Settings\\Application Data\\animats\\ui-mock\\data"
Log path: "C:\\users\\john\\Local Settings\\Application Data\\animats\\ui-mock\\data\\log.txt"
0104:fixme:system:EnableNonClientDpiScaling (000000000001004A): stub
0084:fixme:imm:ImeSetActiveContext (0x3a7b0, 0): stub
0104:fixme:imm:ImeSetActiveContext (0x261270, 1): stub
0084:fixme:imm:ImmReleaseContext (0000000000010020, 000000000003A7B0): stub
0104:fixme:imm:ImmReleaseContext (000000000001004A, 0000000000261270): stub
0104:fixme:ntdll:NtQuerySystemInformation info_class SYSTEM_PERFORMANCE_INFORMATION
0104:fixme:dxgi:dxgi_factory_EnumAdapterByGpuPreference Ignoring GPU preference 0x2.
0104:fixme:dxgi:dxgi_factory_EnumAdapterByGpuPreference Ignoring GPU preference 0x2.
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/john/.cargo/git/checkouts/rend3-e03f89403de3386a/6dd847f/rend3/src/shader.rs:63:60
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Code from shader.rs is:

pub fn add_shaders_embed<T: RustEmbed>(&mut self, prefix: &str) {
        for file in T::iter() {
            let contents = String::from_utf8(T::get(&file).unwrap().data.into_owned()).unwrap();
            self.files.insert(format!("{prefix}/{file}"), contents);
        }
    }

Tried to get a backtrace, but in this environment the unwinder blew up and went into a loop that produced a long stream of the same error, then a crash.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 22 (22 by maintainers)

Most upvoted comments

It’s a bug in either Wine or cross-compile or rust-embed. I built the examples for rust-embed, and example “basic” works on Unix but fails under Wine.

wine basic.exe
0084:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
0084:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
0084:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
0084:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
0084:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
0084:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005
0084:fixme:hid:build_joystick_report_descriptor More than 8 absolute axes found, ignoring.
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', examples/basic.rs:8:45
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Exactly the same problem. the “unwrap()” is for get("index.html").unwrap().

That’s in debug mode. Release mode, where the file actually gets included in the executable, succeeds.