Monday, February 16, 2015

Installing Fortran on Windows with MinGW

As a followup to the previous post using cygwin to emulate linux to install gfortran, this post is the same but using mingw.  From my own experience, cygwin worked on 2/3 of the computers I installed it on.  On the third, it was unusably slow - 2-3 minutes to open terminal.  The instructions online to speed things up were unhelpful - my problem was not addressed.  Fortunately, there is also minwg that does the same thing from the perspective of a scientist that needs a compiler (CS guys might disagree but their purpose would be different).  The biggest difference between the two is that mingw compiles programs to be run on windows while cygwin works on cygwin.

This post is more for me to aggregate the hard work of others so I have a single place to look when installing Fortran on Windows.

Here's the gist:

1) make sure you've got Java installed if you use Eclipse (or other Java-based IDEs) http://www.oracle.com/technetwork/java/javase/downloads/index.html

2) download MinGW from www.mingw.org .  Click Downloads on the left and Download the latest version setup.exe file from sourceforge

3) install minwg as administrator to the c:\ drive.

4) I installed all the packages in the basic setup options (developers kit, base, ada, fortran, c++, object c, msys base)

these will get you started.  The g++ compiler is also available and eventually, installing all pthreads packages will get openMP running.

5) Add path variables:
;C:\MinGW\bin;C:\MinGW\msys\1.0\bin\

5) Check that gfortran is installed by typing gfortran --version into windows command prompt or terminal.  The terminal is in C:\MinGW\msys\1.0  msys.bat opens it.

6) Install Eclipse Parallel tools developer kit (containing Photran) http://www.eclipse.org/ptp/
if you had a previous project running in cygwin, you'll probably have to open a new project so the new addresses for the compilers will be recognized.

No comments: