rust-embed icon indicating copy to clipboard operation
rust-embed copied to clipboard

Fails cross-compiled and run under Wine in debug mode.

Open John-Nagle opened this issue 2 years ago • 1 comments

Chasing down a crash in a program that is cross-compiled from Linux to Windows and then run under Wine 8.0.

Tried building rust-embed's examples.

> cargo build --target x86_64-pc-windows-gnu --examples
> 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

The failed unwrap is for get("index.html").unwrap().

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

I tried putting a file called "index.html" in the same directory as "basic.exe", but it didn't help.

So there's some confusion over where to look for the embedded files. Where is it looking?

Rust 1.67.1 stable, Ubuntu 20.04 LTS, Wine 8.0.

John-Nagle avatar Feb 20 '23 04:02 John-Nagle

Turns out that the macro stores the canonical full path of the embedded file in the executable, for use in debug builds. This is wrong when source host != target host. When source and target are different, debug-embed needs to be set, even in debug mode.

John-Nagle avatar Feb 21 '23 05:02 John-Nagle

Thanks!

John-Nagle avatar Apr 20 '24 02:04 John-Nagle