Why does the gnu backend on Windows create such a large binary?

The Release Page.

The GitHub workflow file.

A couple of possible reasons:
1.The binary was built in debug mode. Debug symbols can be large
2. The binary hasn't been stripped

This is the CI command that build both Windows/MSVC and Windows/GNU. The only different between them is matrix.target, yet the GNU binary is 5 times bigger.

MSVC puts the debug symbols in a pdb file not in the exe file.


Aside from debugging info, the Windows versions of the GNU toolchains tend to statically link their C/C++ runtime support (libgcc, libc/libstdcxx etc.) as these can’t be assumed to be present on users’ Windows systems. I’ve no idea if this is a factor with pure Rust (Rust statically links its runtime anyway), but if you’re using dependencies written in C/C++ that’ll probably do it.