https://www.symscape.com/configure-msmpi-for-mingw-w64
https://www.symscape.com/configure-msmpi-v8-1-for-mingw-w64
Gather MPI distribution from Windows
Copy C:\Program Files\Microsoft HPC Pack 2012 to a temp location (e.g., D:\projects\mpi\ms-hpc) then copy C:\Windows\System32\msmpi.dll to \Lib\amd64.
Transfer to Linux. Create libmsmpi.a on Linux
Assuming the MSMPI distribution copied over from Windows, in the previous step, is located at (e.g., $HOME/projects/msmpi/ms-hpc) create libmsmpi.a using:
cd <msmpi-linux-home>/Lib/amd64
gendef msmpi.dll - creates msmpi.def
x86_64-w64-mingw32-dlltool -d msmpi.def -l libmsmpi.a -D msmpi.dll - creates libmsmpi.a
Fix missing __int64 definition
You will need to add #include <stdint.h> to /Inc/mpi.h:127 to define __int64.
Set compiler flags for user code
Compile in Linux using MinGW-w64 (e.g., x86_64-w64-mingw32-gcc) with compiler flags:
-I<msmpi-linux-home>/Inc
-L<msmpi-linux-home>/Lib/amd64
-lmsmpi
7z x mpi_64.msi
gendef msmpi64.dll
x86_64-w64-mingw32-dlltool -d msmpi64.def -l libmsmpi.a -D msmpi64.dll