wiki:GnuFortran

Version 19 (modified by skbhate, 17 years ago) ( diff )

--

Build ROMS using gfortran on Win32 Machine

Below is the step by step procedure for a successful compilation of ROMS3.0 on a win32 machine under Cygwin.

  • Cygwin setup for gfortran

In order for gfortran to work properly on Cygwin, make sure you have math packages GMP and MPFR installed on your machine. Open a Cygwin shell and type the following commands to confirm you have GMP and MPFR packages.

$ cygcheck -c | grep gmp (If you see what is shown below then you're ok)

gmp 4.2.1-1 OK

libgmp3 4.2.1-1 OK

$ cygcheck -c | grep mpfr (If you see what is shown below then you're ok)

libmpfr1 2.2.1-1 OK

mpfr 2.2.1-1 OK

If cygcheck fails to report the GMP and MPFR package installations, then install these packages using Cygwin Setup. These packages are found under 'Libs' category in package installation list of cygwin setup.

  • Installing gfortran
    • Get the latest gfortran binary for Cygwin. (e.g. gfortran-4.3-Cygwin-i686.tar.bz2)
    • Open a cygwin shell, locate the gfortran tar file, and type the following commands. This will install gfortran in /usr/local/bin and will be included in your search path.

$ tar -xjvf gfortran-4.3-Cygwin-i686.tar.bz2 -C /

$ ln -s /usr/local/gfortran/bin/gfortran.exe /usr/local/bin/gfortran

$ gfortran --version (You should see something as shown below to know that gfortran is working on your system)

GNU Fortran (GCC) 4.3.0 20070512 (experimental) Copyright (C) 2007 Free Software Foundation, Inc.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law. You may redistribute copies of GNU Fortran under the terms of the GNU General Public License. For more information about these matters, see the file named COPYING

  • Building Netcdf and Netcdf-90 interface with gfortran support
    • Get the latest netcdf stable release (netcdf-3.6.2 from Unidata.
    • Open a Cygwin shell and type the following commands to correctly build and install netcdf and netcdf-90 interface on your system.

$ CC=gcc FC=gfortran F90=gfortran F77=gfortran CPPFLAGS=-DpgiFortran ./configure --prefix=/usr/local/netcdf/gfortran (All in one line)

$ make

$ make check

$ make install (This will install netcdf in path you've provided with --prefix during configure)

  • Building ROMS 3.0
    • Get the latest version of ROMS 3.0 from svn. (Tested stable svn version 843)
    • Open a Cygwin shell and locate the ROMS root directory where you have just checked out the latest version.
    • Type the following commands to setup the environment variables using the netcdf install path you've specified during the netcdf build in previous section. You can do this over the command line or you can include them in ROMS/Bin/build.sh (in case you open a new shell you do not have to reset these environmental variables)

$ export NETCDF_LIBDIR=/usr/local/netcdf/gfortran/lib

$ export NETCDF_INCDIR=/usr/local/netcdf/gfortran/include

Modify ROMS/Bin/build.sh according to your requirements and run build.sh.

Note: See TracWiki for help on using the wiki.