AMAPstudio

# How to install MinGW and an example of Fortran compilation using MinGW

## 1. Description

MinGW means Minimalist GNU for Windows. It is a minimalist development environment for native Microsoft Windows applications (see http://www.mingw.org/).

MinGW is used in Capsis to generate executables from Fortran, C, C++, … source files to be run on Windows operating systems. These executables are used in some Capsis modules. It is for example the case with the genotype_generator.f90 Fortran source file which corresponding executable is called by the Luberon2 module.

## 2. Installation

### 2.1. Installation of MinGW

MinGW can be installed by using the following steps:

• Click on Downloads tab at the top of the page or go directly to https://osdn.net/projects/mingw/releases/.
• Click on the button allowing to download the mingw-get-setup.exe file.
• When downloaded, double-click on mingw-get-setup.exe in order to launch the MinGW installer.
• In the first window, click on Install button.
• On the Step 1: Specify Installation Preferences window, choose the installation directory (C:\MinGW by default), let the checked options and click on Continue button.
• You access the Step 2: Download and Set Up MinGW Installation Manager window. When download progress is completed, click on Continue button.
• You access the MinGW Installation Manager window. You have choice between Basic Setup and All Packages installations. Choose Basic Setup and install all the proposed packages (for each package, click on it and select Mark for Installation). The packages to be marked for installation are: mingw-developer-toolkit-bin, mingw32-base-bin, mingw32-gcc-ada-bin, mingw32-gcc-fortran-bin, mingw32-gcc-g++-bin, mingw32-gcc-objc-bin and msys-base-bin.
• When all packages have been marked, click on Installation at the top of the window, then click on Apply Changes and at least click on Apply button on the opening window.
• The download of packages begins. When all the packages have been successfully downloaded, click on the Close button and close the MinGW Installation Manager window.

Remark: if some dll files are not found during packages download process, they can be found here : https://sourceforge.net/projects/mingw/files/OldFiles/ contained in .tar.xz files that can be uncompressed. The missing dll files have to be copied in the bin sub directory of the installed MinGW directory.

### 2.2. Configuration of the Path environment variable

In order the system knows where to find the executables contained in the installed MinGW directory, you have to modify the Path system environment variable. To do that (example on Windows 7):

• Click on Configuration panel then on Sytem and security and at least on System.
• Click on Advanced system parameters.
• In the System properties opening window, click on the Environment variables button.
• In the System variables section of the opening Environment variables window, click on the Path variable and then click on the Modify button. Add at the beginning of the Path variable the path to the bin sub directory of the installed MinGW directory (for example C:\MinGW\bin) ended with a “;” (; is the separator of the different paths stored in the Path environment variable) and click on the OK button.
• Click on OK button to close the Environment variable window and again on OK button to close the System properties window.

## 3. Example of Fortran compilation

Instructions for compiling the genotype_generator.f90 source file (Fortran 90 code called from Luberon2 module) using the gfortran executable stored in the bin sub directory from the MinGW installed directory (example: C:\MinGW\bin) are:

• Open a prompt (type cmd in the Search programs and files section).
• Go in the directory where genotype_generator.f90 source file is stored.
• Type the following compilation command to generate the genotype_generator.exe executable file:
gfortran genotype_generator.f90 -o genotype_generator.exe
documentation/mingw-installation.txt · Last modified: 2019/01/09 15:19 by beudez