MinGW brings GNU compiler tools to Windows since the late 1990s.
MSYS2 provides numerous developer tools including MinGW on Windows using
pacman package manager.
msys2-x86_64-*.exe and run the installer, installing to C:/msys64.
MSYS2 needs to be on a non-FAT / non-ExFAT drive capable of symbolic links, such as
Start the MSYS2 console in the Windows Start menu, which sets up all the needed paths, just for that terminal session. Update MSYS2 to get the latest packages in the MSYS2 terminal. Run this command multiple times until it says “nothing to do”.
To use MSYS2 / MinGW64 programs from PowerShell without disrupting other compiler use, we create ~/gcc.ps1 containing:
$Env:CC="gcc" $Env:FC="gfortran" $Env:CXX="g++" $Env:path += ";c:/msys64/mingw64/bin/"
When it’s desired to use MSYS from a Powershell prompt run ~/gcc.ps1.
If you add MSYS to the Windows system path or user path for all sessions, this can disrupt other compilers including Intel compilers. Thus as usual we only temporarily use MSYS upon request via the ~/gcc.ps1 script.
From MSYS2 command prompt, tasks include:
Search for packages:
pacman -Ss gcc
Install MinGW packages
pacman -S mingw64/mingw-w64-x86_64-gcc
pacman -S mingw64/mingw-w64-x86_64-gcc-fortran
pacman -S mingw64/mingw-w64-x86_64-hdf5
pacman -S mingw64/mingw-w64-x86_64-ninja
pacman -S mingw64/mingw-w64-x86_64-make
pacman -S mingw64/mingw-w64-x86_64-pkg-config
pacman -S mingw64/mingw-w64-x86_64-aspell mingw64/mingw-w64-x86_64-aspell-en
If you have confusion about why another version of a program is being used, check executable location like:
You may need to reorder directories in your Windows Path variable, for example GNU Octave may need to be moved lower in the Path list or removed from Path.