Context: I'm trying to make this Meson unit test work when cross compiling for Windows on Linux: https://github.com/mesonbuild/meson/tree/master/test%20cases/rust/4%20polyglot.
Build logs:
[1/4] /usr/bin/x86_64-w64-mingw32-gcc -Iprog.exe.p -I. -I.. -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O0 -g -MD -MQ prog.exe.p/prog.c.obj -MF prog.exe.p/prog.c.obj.d -o prog.exe.p/prog.c.obj -c ../prog.c
[2/4] rustc --target x86_64-pc-windows-gnu -C linker=/usr/bin/x86_64-w64-mingw32-gcc --color=always -C debug-assertions=yes -C overflow-checks=no --crate-type cdylib -g --crate-name stuff --emit dep-info=stuff.d --emit link -o stuff.dll ../stuff.rs
[3/4] /home/xclaesse/.local/bin/meson --internal symbolextractor '/home/xclaesse/programmation/meson/test cases/rust/4 polyglot/builddir' stuff.dll stuff.dll.lib stuff.dll.p/stuff.dll.symbols --cross-host=windows
[4/4] /usr/bin/x86_64-w64-mingw32-gcc -o prog.exe prog.exe.p/prog.c.obj -Wl,--allow-shlib-undefined stuff.dll.lib -Wl,--subsystem,console -Wl,--start-group -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -Wl,--end-group
FAILED: prog.exe
/usr/bin/x86_64-w64-mingw32-gcc -o prog.exe prog.exe.p/prog.c.obj -Wl,--allow-shlib-undefined stuff.dll.lib -Wl,--subsystem,console -Wl,--start-group -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -Wl,--end-group
/usr/bin/x86_64-w64-mingw32-ld: cannot find stuff.dll.lib: No such file or directory
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
When cross compiling, stuff.dll.lib is indeed not generated by the rustc command. The same project when built natively on Windows works, that command does generate stuff.dll.lib on Windows:
rustc -C linker=link --color=always -C debug-assertions=yes -C overflow-checks=no --crate-type cdylib -g --crate-name stuff --emit dep-info=stuff.d --emit link -o stuff.dll ../stuff.rs