After making a lot of confusion with Rust cross-compiling, I finally managed to compile WinSafe x32 programs in my Windows x64. The root of the misunderstanding is that, in order to cross compile, you must have the following installed:
- MSVC build tools;
- Rust toolchain;
- Rust target.
Toolchain relevant commands:
rustup toolchain list rustup toolchain install stable-i686-pc-windows-msvc rustup toolchain uninstall stable-i686-pc-windows-msvc
Target relevant commands:
rustup target list | grep installed rustup target add i686-pc-windows-msvc --toolchain stable rustup target remove i686-pc-windows-msvc
To verify if you program has any linker issues, build and run:
rustup run stable-i686-pc-windows-msvc cargo run rustup run stable-x86_64-pc-windows-msvc cargo run
Then finally the program can be built for release with:
RUSTFLAGS='-C target-feature=+crt-static' cargo build --release --target i686-pc-windows-msvc RUSTFLAGS='-C target-feature=+crt-static' cargo build --release --target x86_64-pc-windows-msvc
I only found all that stuff after posting a question on StackOverflow and receiving this comment. The documentation was completely absent in providing any useful information.