Cross-compiling crate egui Linux->Win, can't find "core"

I'm looking for a bug that involves egui, so I'm trying to bujild its examples. They work fine on Linux, the current platform, but if I try to cross-compile for Windows, I get:

cargo build -p keyboard_events --target x86_64-pc-windows-gnu
  Downloaded paste v1.0.14
  Downloaded tempfile v3.8.0
  Downloaded windows-interface v0.48.0
  Downloaded accesskit_windows v0.15.1
  Downloaded windows-implement v0.48.0
  Downloaded 5 crates (110.7 KB) in 0.86s
   Compiling proc-macro2 v1.0.67
   Compiling autocfg v1.1.0
   Compiling unicode-ident v1.0.12
   Compiling windows_x86_64_gnu v0.48.5
   Compiling cfg_aliases v0.1.1
   Compiling khronos_api v3.1.0
   Compiling cfg-if v1.0.0
   Compiling log v0.4.20
   Compiling once_cell v1.18.0
   Compiling winapi-x86_64-pc-windows-gnu v0.4.0
   Compiling xml-rs v0.8.19
error[E0463]: can't find crate for `core`
  |
  = note: the `x86_64-pc-windows-gnu` target may not be installed
  = help: consider downloading the target with `rustup target add x86_64-pc-windows-gnu`

error[E0463]: can't find crate for `compiler_builtins`

For more information about this error, try `rustc --explain E0463`.
error: could not compile `cfg-if` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error[E0463]: can't find crate for `std`
  |
  = note: the `x86_64-pc-windows-gnu` target may not be installed
  = help: consider downloading the target with `rustup target add x86_64-pc-windows-gnu`

error[E0463]: can't find crate for `alloc`
   --> /home/john/.cargo/registry/src/index.crates.io-6f17d22bba15001f/once_cell-1.18.0/src/lib.rs:370:1
    |
370 | extern crate alloc;
    | ^^^^^^^^^^^^^^^^^^^ can't find crate

error: cannot find macro `panic` in this scope
  --> /home/john/.cargo/registry/src/index.crates.io-6f17d22bba15001f/log-0.4.20/src/__private_api.rs:17:9
   |
17 |         panic!(
   |         ^^^^^

The "x86_64-pc-windows-gnu" Rust target is definitely installed. See "rustup show" below. It even cross-compiles successful for other programs that use "egui" as a library crate. Not clear why it fails here.

rustup show
Default host: x86_64-unknown-linux-gnu
rustup home:  /home/john/.rustup

installed toolchains
--------------------

stable-x86_64-apple-darwin
stable-x86_64-pc-windows-gnu
stable-x86_64-unknown-linux-gnu (default)
1.72.0-x86_64-unknown-linux-gnu

installed targets for active toolchain
--------------------------------------

wasm32-unknown-unknown
x86_64-unknown-linux-gnu

active toolchain
----------------

1.72.0-x86_64-unknown-linux-gnu (overridden by '/home/john/projects/egui/rust-toolchain')
rustc 1.72.0 (5680fa18f 2023-08-23)

I might be wrong, but it seems like you have installed the windows toolchain, but you should install the windows target instead with rustup target add x86_64-pc-windows-gnu.

This is my configuration for comparison:

$ rustup show
Default host: x86_64-unknown-linux-gnu
rustup home:  /home/riccardo/.rustup

installed targets for active toolchain
--------------------------------------

aarch64-unknown-linux-gnu
aarch64-unknown-linux-musl
armv7r-none-eabi
x86_64-pc-windows-gnu
x86_64-unknown-linux-gnu
x86_64-unknown-linux-musl

active toolchain
----------------

stable-x86_64-unknown-linux-gnu (default)
rustc 1.75.0 (82e1608df 2023-12-21)

Notice that I have a single toolchain (for the host), and many targets for the different cross-compilation targets.

OK, upgraded Rust to current and installed the additional target. Now I get linker errors for an unrecognized linker directive.

I can build other programs that use eguj for the x86_64-pc-windows-gnu target. This only comes up when building egui's own examples. There must be somethint special in egui's build, but I'm not seeing it. Nothing jumps out at me in the Cargo.toml files.

cargo build --target x86_64-pc-windows-gnu
   Compiling file_dialog v0.1.0 (/home/john/projects/egui/examples/file_dialog)
   Compiling save_plot v0.1.0 (/home/john/projects/egui/examples/save_plot)
error: linking with `x86_64-w64-mingw32-gcc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/home/john/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/john/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin" VSLANG="1033" "x86_64-w64-mingw32-gcc" "-fno-use-linker-plugin" "-Wl,--dynamicbase" "-Wl,--disable-auto-image-base" "-m64" "-Wl,--high-entropy-va" "/home/john/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/rsbegin.o" "/tmp/rustcciJq8x/symbols.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.17j0aybw0z6hvex5.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.1b920tl5qolxgtmc.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.1eyj3hrb5aml0xb.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.1mlh0wgztszj5v4p.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.1ovhyjg6n8tjf3e8.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.1rfvbekpzlqs2oay.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.1uhvhncoeqb96e3t.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.216m60ozzge000yy.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.23wmo8d9sawv0hv0.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.24l2xrmnqsxu0vqd.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.2776riw2r5sh5rzi.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.27cb7lf82kvjtykl.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.2heriew1z7g2k999.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.2lm3coym6pshe9st.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.2qcad035edbpgp7y.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.2qimavdlyz2n4pp1.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.2t4bcfu3cy2vqho7.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.2wdy836b8oazhjfi.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.2yeqtomqk1675pa7.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.2ziqomxx4uass2zg.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.322kny0bv702b5ye.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.340plzb1lmzl0nmv.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.35d58eo87040ainm.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.3cus2oi7qv16j2q5.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.3dzu6djnk4v7u53n.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.3sb4pjh6reqxnwj9.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.3t56wazmmibrr08v.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.3tmjmwrwkcofk6yu.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.3vy8nulpd3bojlck.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.424b6g9d9o6kpjcn.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.47fy81h01i6uonb8.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.48txe29ej5zkj912.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.4hc2hy2pkdryr6or.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.4kazqmkmi5ia8df0.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.4s0opdxis93ov4ei.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.4s9luxhm8otfpxjl.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.4t5886w3l539pl36.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.4y9spul4ptvwwhzv.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.59d99at79z8ioqcq.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.5e9nuh9ykeuyklaj.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.cgawymma01rh2jp.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.f9kwrzsq7817f74.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.ix3k7oqoojb17am.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.qhry6z6xtzqbyj.rcgu.o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.2moo1l7odclazwog.rcgu.o" "-L" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps" "-L" "/home/john/projects/egui/target/debug/deps" "-L" "/home/john/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winapi-x86_64-pc-windows-gnu-0.4.0/lib" "-L" "/home/john/.cargo/registry/src/index.crates.io-6f17d22bba15001f/windows_x86_64_gnu-0.48.5/lib" "-L" "/home/john/.cargo/registry/src/index.crates.io-6f17d22bba15001f/windows_x86_64_gnu-0.42.2/lib" "-L" "/home/john/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib" "-Wl,-Bstatic" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/librfd-51da082dde41bdac.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libwindows-bfaec5b31f76320f.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libenv_logger-498031250d012ef0.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libis_terminal-7b07410b9de4333a.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libhumantime-f4bcd053b7b0f59b.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libeframe-18f83e37cf98324e.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libpollster-dbae79c038445c49.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libglutin_winit-9cd8d95497b6777c.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libdirectories_next-46fc132fb312ac6a.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libdirs_sys_next-66e2d26ddeb84d4b.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libimage-8da37af0f3636e1a.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libcolor_quant-33116e5e43728fc7.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libpng-9f53d2dd5409193b.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libflate2-4483d0a575ee2401.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libminiz_oxide-61e62f1a136722de.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libfdeflate-4c228cb7bb474dac.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libsimd_adler32-e45e46bbb8983928.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libcrc32fast-f01786414619bf4d.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libnum_rational-8bfbdccbf4715e73.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libnum_integer-bc63485de5ab517b.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libjpeg_decoder-3483ca6929f68d20.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libglutin-67cd9c294200291b.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libglutin_egl_sys-a9694f2631af5d7e.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libegui_winit-48c32ec1b5636f09.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libwebbrowser-aab116378abf773e.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/liburl-6c0166cb068ae057.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libidna-160ef1de5c9c9efd.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libunicode_normalization-fb30e44487e78739.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libtinyvec-eeaac25df3401ac2.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libtinyvec_macros-b65d87cd04eb0a3e.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libunicode_bidi-a6872cbc25810838.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libform_urlencoded-1c7a65f7da97683f.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libpercent_encoding-a81b905f2b644e89.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libweb_time-7e38584261f6054a.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libarboard-3d59f744e2c77028.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libclipboard_win-1c1a3f5727793837.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/liberror_code-c29aad0092f6aebd.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libstr_buf-ef168cc88eb86160.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libaccesskit_winit-3f8210ad86521fb4.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libaccesskit_windows-ed785ceff13190c0.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libwindows-16ffdb5e901c8b81.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libaccesskit_consumer-e4e258a9c7f87de1.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libegui_wgpu-2413a14eb37f3f33.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libwinit-a8a2884cc259306b.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libcursor_icon-05a548bbf7d85b1d.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libunicode_segmentation-62f3f89bf47cc4e3.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libsmol_str-2fe6b35288abf346.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libraw_window_handle-9de134e927ac52a6.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libtype_map-d8e8fa10b792701f.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libwgpu-314b1ce9fb5608b5.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libflume-7035493513bfef98.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libfutures_sink-9710f244136900e0.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libfutures_core-a2e43635375e6a46.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libnanorand-eeae4780fc77ece7.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libgetrandom-4c80a22d89588f22.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libspin-bce9f97c0d4a09f4.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libstatic_assertions-c467deaae24fb295.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libwgpu_core-183454f851ce155e.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libwgpu_hal-3ecf9377b8ab5e6b.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/librenderdoc_sys-188cbe61c0757c8c.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libgpu_descriptor-9716c71686b7f46e.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libgpu_descriptor_types-a1573295396de2a1.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libhassle_rs-b19cacb4000af37a.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libwidestring-8b364d125d960bd3.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libcom_rs-5a9d81e3ee141eb0.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libprofiling-28d9de284a37437e.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libgpu_alloc-6a3e4da5a109ef99.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libgpu_alloc_types-9db2ea4eb76a30db.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libash-2019be0c3c04de56.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/liblibloading-753540b6cc38dc34.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libraw_window_handle-809c7996cd0bd1f3.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libglutin_wgl_sys-22a5c253b40c507a.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libgpu_allocator-50298a26a292faf0.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libwindows-80cdf1006d0d73df.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libwindows_core-d4643c657986e639.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libd3d12-2d6f04f8549c74e4.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/liblibloading-d6ed6a8383e47d78.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libwindows_sys-48c62436a7086297.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libnaga-1bba5d5cd907cafc.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/librustc_hash-cbf3880aab2a1276.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libhexf_parse-93f96291f53d956f.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libunicode_xid-448297c08c9b9991.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libindexmap-672b14c246e46ce3.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libequivalent-73378915484c01ea.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libhashbrown-05322a6e9c62e5f0.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/liballocator_api2-17af82796eef6d61.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libcodespan_reporting-63abe97fae6feaad.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libunicode_width-e69c8037ef37fc7d.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libtermcolor-dcc6b5c6b995d40f.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libwinapi_util-38c71ae71d9845d6.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libspirv-935f0e35e5b798ef.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libnum_traits-137845453532ace4.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libbitflags-205d6597bc949b7a.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/librange_alloc-8a5f126518edc324.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libbit_set-efe85a9aedebe8c7.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libbit_vec-78425a967d3ef37f.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libwgpu_types-a77368f9693c60b7.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libwinapi-9c0f3ed1e5aacbc2.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libthiserror-715dabea158adb9d.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libarrayvec-89ca3ec272f2a253.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libegui_glow-345ae384712494f5.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libmemoffset-b51fc3e0e3d616ee.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libglow-9ab6f1fc117ede13.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libegui-59bb528879a0d4fe.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libbacktrace-7b9f6b4d174fbf8b.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libobject-72dc82f038bf07b3.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libmemchr-084441349d8a3ee4.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/liblibc-ed38fec53f324e04.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libaddr2line-46b92ab367130bb7.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libgimli-df9d457ac11668a7.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/librustc_demangle-8ac288a2ad718cb7.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libron-4d42a14d90ab6b09.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libbitflags-2fbae6e2cf9538cc.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libbase64-859558974825dd20.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libpuffin-2cd4c85c5b5692d2.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/liblz4_flex-f4f71a8727063b33.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libanyhow-9c2c08542d8804ae.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libbincode-2dfba13c5407cc64.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libbyteorder-2483c29ad9d4c7ac.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libaccesskit-03c202611c766226.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libepaint-5ba6c4d02c425465.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libnohash_hasher-00bd2dad00660cc6.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/liblog-3cfdaa5c5c67ff58.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libecolor-8c262a4f790edfa2.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libahash-d58602f6d39c3c0c.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libonce_cell-ad78b7fd795d4968.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libzerocopy-05466bf38bdaae3c.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libab_glyph-d9104ee4155e6f12.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libowned_ttf_parser-48b6c73bcfbc8869.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libttf_parser-4085c9ba17d9b79a.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libab_glyph_rasterizer-a05229770a142841.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libparking_lot-62182255a0a8e5a6.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libparking_lot_core-dcf179748b20d75e.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libwindows_targets-e19af10892af463d.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libcfg_if-e8822b4936841497.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libsmallvec-306936fac21c3676.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/liblock_api-e92ce45dccd6622f.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libscopeguard-fa88e9217fbd1ba1.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libemath-0fa603e4d15defda.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libbytemuck-405f1284578bd0a3.rlib" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/libserde-002f3ed1829bdcaa.rlib" "/home/john/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/libstd-274cab44dc4a644c.rlib" "/home/john/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/libpanic_abort-811ac7ae6280b8b6.rlib" "/home/john/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/libobject-06bb167660b3da76.rlib" "/home/john/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/libmemchr-8ab6cc09499ecf5b.rlib" "/home/john/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/libaddr2line-126153ebe55b6775.rlib" "/home/john/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/libgimli-3d08640ec0a90b99.rlib" "/home/john/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/librustc_demangle-e211ed0efcaf0dab.rlib" "/home/john/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/libstd_detect-f17f8b04b9a04cbd.rlib" "/home/john/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/libhashbrown-dc505c5f7a08eb2f.rlib" "/home/john/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/librustc_std_workspace_alloc-29139547fec356ea.rlib" "/home/john/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/libminiz_oxide-cab94e250dc1e17d.rlib" "/home/john/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/libadler-e6226bb3d40532fc.rlib" "/home/john/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/libunwind-bc036f0a729eca3e.rlib" "/home/john/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/libcfg_if-b7a734954c1f5dcb.rlib" "/home/john/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/liblibc-a254eeb9e90dc361.rlib" "/home/john/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/liballoc-b6fb9ac972c98305.rlib" "/home/john/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/librustc_std_workspace_core-6db27a6ad3c9479a.rlib" "/home/john/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/libcore-6fcad14090edadfc.rlib" "/home/john/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/libcompiler_builtins-625af2eb18940f92.rlib" "-Wl,-Bdynamic" "-lwindows" "-lshlwapi" "-lwindows.0.48.5" "-lbcrypt" "-ladvapi32" "-luuid" "-lopengl32" "-lwindows.0.48.5" "-lwindows.0.48.5" "-lwindows.0.48.5" "-lwinapi_advapi32" "-lwinapi_cfgmgr32" "-lwinapi_credui" "-lwinapi_d2d1" "-lwinapi_d3d11" "-lwinapi_d3d12" "-lwinapi_d3dcompiler" "-lwinapi_dcomp" "-lwinapi_dwrite" "-lwinapi_dxgi" "-lwinapi_gdi32" "-lwinapi_kernel32" "-lwinapi_msimg32" "-lwinapi_ole32" "-lwinapi_oleaut32" "-lwinapi_opengl32" "-lwinapi_secur32" "-lwinapi_shell32" "-lwinapi_shlwapi" "-lwinapi_synchronization" "-lwinapi_user32" "-lwinapi_windowscodecs" "-lwinapi_winspool" "-lkernel32" "-lwindows.0.48.5" "-lkernel32" "-ladvapi32" "-lbcrypt" "-lkernel32" "-lntdll" "-luserenv" "-lws2_32" "-lkernel32" "-lws2_32" "-lkernel32" "-lgcc_eh" "-l:libpthread.a" "-lmsvcrt" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-luser32" "-lkernel32" "-Wl,--nxcompat" "-L" "/home/john/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib" "-o" "/home/john/projects/egui/target/x86_64-pc-windows-gnu/debug/deps/file_dialog-baa135b4eceb963f.exe" "-Wl,--gc-sections" "-no-pie" "-nodefaultlibs" "/home/john/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/rsend.o"
  = note: Warning: .drectve `-exclude-symbols:_ZN4core3ops8function5FnMut8call_mut17h1efbd38256129860E ' unrecognized
          Warning: .drectve `-exclude-symbols:"_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17h1a838945849f56b8E" ' unrecognized
          Warning: .drectve `-exclude-symbols:"_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17h290148a8815fe835E" ' unrecognized
          Warning: .drectve `-exclude-symbols:"_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17h3167f990574eea3fE" ' unrecognized
          Warning: .drectve `-exclude-symbols:"_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17h4d6957ceddecded8E" ' unrecognized
          Warning: .drectve `-exclude-symbols:"_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17h8e6ef50081baee4cE" ' unrecognized
          Warning: .drectve `-exclude-symbols:"_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17h8fb5e06d5ba57b45E" ' unrecognized

I can reproduce your issue. I got it working by removing the save_plot and file_dialog examples [1]:

$ rm rust_toolchain # not really needed
$ rm -r examples/save_plot
$ rm -r examples/file_dialog
$ cargo build --target x86_64-pc-windows-gnu
[...]
    Finished dev [unoptimized + debuginfo] target(s) in 4m 01s

Not a real solution, but it narrows the problem down to the two examples save_plot and file_dialog.


  1. and removing the rust_toolchain file so I don't need to download the older 1.72.0 toolchain ↩︎

1 Like

You can try to compile using Docker. And there would be no need in adding linkers or toolchains.
Or by using VM. When I have issues like this one I prefer to use one of these methods because fighting with cross compiling can be really bothering

Ah. Those both involve file dialogs. There's a cfg feature to use "native dialogs" instead of the rfd crate. (The "rfd" crate does this portably and works fine under Wine.) If native mode is on, "eframe" is used in native mode.

I still don't see why that breaks the build, though.

1 Like

Obligatory cross compiling in Rust question: have you tried this with cross-rs? Does that make it work? I found it the best way to cross compile to Windows as well as other Linux architectures.

Filed Egui issue: Some examples with native file dialogs will not build on cross-compile Linux -> x86_64-pc-windows-gnu · Issue #3836 · emilk/egui · GitHub

Now that it's clear this is just a problem with the examples that use native file dialogs, it's not critical. Thanks.

2 Likes