== 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 [wiki:Cygwin Cygwin]. * '''Cygwin setup for gfortran''' In order for gfortran to work properly on [wiki:Cygwin Cygwin], make sure you have math packages [http://cran.r-project.org/doc/packages/gmp.pdf GMP] and [http://www.mpfr.org/ 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 [wiki:Cygwin Cygwin] Setup. These packages are found under 'Libs' category in package installation list of cygwin setup. * '''Installing gfortran''' * Get the latest [http://gcc.gnu.org/wiki/GFortranBinaries 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 ([http://www.unidata.ucar.edu/downloads/netcdf/ftp/netcdf.tar.gz netcdf-3.6.2] from Unidata. * Open a Cygwin shell and type the following commands to correctly unpack, build, and install netcdf and netcdf-90 interface on your system. ''$ cd ~/netcdf-3.6.2'' (Or wherever the netcdf directory is.) ''$ tar -xzvf netcdf-3.6.2.tar.gz'' (Note that other archiving tools, like Winzip, might add carriage returns, which will make ''./configure'' choke.) ''$ 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. (These commands are for Bash shell only. Use the respective commands for other shells e.g. CSH etc.). ''$ export NETCDF_LIBDIR=/usr/local/netcdf/gfortran/lib'' ''$ export NETCDF_INCDIR=/usr/local/netcdf/gfortran/include'' Copy ROMS/Bin/build.bash to your project directory (not in the source distribution), modify according to your requirements and then type ''$ ./build.bash''