first get cygwin rust (unofficial) from here (we will reconfigure it for linking against msys DLL instead of cygwin)
make sure you have gcc
install for msys environment and run these in the MINGW64 terminal
export PATH=/path/to/cygwin-rust/bin:$PATH
cargo new --bin hellohi && cd hellohi
# must be called x86_64-pc-cygwin.json! (i.e. don't change the file name!)
rustc -Z unstable-options --target=x86_64-pc-cygwin --print target-spec-json > x86_64-pc-cygwin.json
patch -p1 -i path/to/x86_64-pc-cygwin.json.diff
# must place the json under the current directory!
cargo build --target=x86_64-pc-cygwin.json
# don't get tricked by the target name, it's now linked against msys-2.0.dll!
ldd ./target/x86_64-pc-cygwin/debug/hellohi.exe
./target/x86_64-pc-cygwin/debug/hellohi.exe
should give:
ntdll.dll => /c/WINDOWS/SYSTEM32/ntdll.dll (0x7ff9535d0000)
KERNEL32.DLL => /c/WINDOWS/System32/KERNEL32.DLL (0x7ff9530c0000)
KERNELBASE.dll => /c/WINDOWS/System32/KERNELBASE.dll (0x7ff950ad0000)
msys-2.0.dll => /usr/bin/msys-2.0.dll (0x180040000)
Hello, world!