Difference between revisions of "GENIE WindowsCompilation"

From SourceWiki
Jump to navigation Jump to search
Line 119: Line 119:
 
<strong>g95 Compiler</strong>
 
<strong>g95 Compiler</strong>
  
   FC=g95 FFLAGS=-fno-second-underscore ./configure --prefix=<netcdf_root_cygpath>
+
   FC=g95 ./configure --prefix=<netcdf_root_cygpath>
   make
+
   make check
 
   make install
 
   make install
  

Revision as of 22:21, 17 March 2008

Building GENIE on Windows Platforms

The GENIE makefiles have been modified to enable a command line compilation of the framework under Windows using Linux emulation software.

Prerequisites

The build system is known to work with the following software:

Tool Software Versions Notes
Linux emulation CygWin 1.5.12-1  
MinGW (MSYS) 1.0.10 Build only. There is no bash shell available so genie_example.job cannot be executed.
Third party libraries NetCDF 3.5.0, 3.6.0, 3.6.1, 3.6.2 Pre-built dll from UCAR can be used with the native microsoft compilers. We recommend building the NetCDF library locally.
Python 2.3.3+ Available in CygWin. Must be installed separately for MinGW.
Native Microsoft Fortran Compiler Compaq Visual Fortran 6.6C  
Intel Visual Fortran 9.1, 10.0, 10.1  
C/C++ Compiler / Linker Microsoft Visual Studio .NET 2003 7.1.3088  
Microsoft Platform SDK for Server 2003 R2  
Microsoft Visual Studio 2005 8.0.50727.762  
GNU Compilers Fortran Compiler GNU g95 0.91  
C/C++ Compiler / Linker GNU gcc 4.0.3  
GNU ld 2.16.91  

Installing a Linux Emulator

In order to execute the GENIE build process on a Windows platform it is necessary to install a Linux emulator that can process the GNU make files. There are two popular Linux emulation tools for Windows; Cygwin and MinGW. Cygwin provides a comprehensive Linux emulation layer for Windows and can be used to build, execute and manage GENIE. MinGW (Minimalist GNU for Windows) provides a limited set of tools that are sufficient to build GENIE but cannot be used to configure the model for execution. We therefore recommend the Cygwin route but provide details of MinGW for completeness.

Cygwin installation

Download the Cygwin setup executable from the Cygwin website at http://cygwin.com/. Execute the setup program and install Cygwin as directed. When asked to select packages please ensure that the following packages are installed:

  • Base -> bash
  • Devel -> make
  • Interpreters --> python
  • Interpreters --> perl (for documentation)
  • gfortran specific requirements
    • Math --> gmp
    • Math --> mpfr

GNU g95 Compiler

For up to date details please see http://ftp.g95.org/#Win. Download g95-x86-cygwin.tgz from http://ftp.g95.org/g95-x86-cygwin.tgz. Copy this file to the root of your cygwin distribution. In cygwin:

 cd /
 tar zxvf g95-x86-cygwin.tgz

GNU gFortran Compiler

For up to date details please see http://gcc.gnu.org/wiki/GFortranBinariesCygwin. Download the latest release of the compiler. A link to the location of the latest release can be found at http://gcc.gnu.org/wiki/GFortranBinaries. Move the release archive to the Cygwin root directory. In Cygwin:

 cd /
 tar jxvf gfortran-4.3-Cygwin-i686.tar.bz2
 ln -s /usr/local/gfortran/bin/gfortran.exe /usr/local/bin/gfortran
 ln -s /usr/local/gfortran/bin/gfortran.exe /usr/local/bin/gfc

MinGW installation

MinGW http://www.mingw.org/ provides a build environment capable to generating Windows executables that do not rely on 3rd party dlls.

Building NetCDF

Download NetCDF source release from UCAR:

 http://www.unidata.ucar.edu/downloads/netcdf

Extract the contents of the archive to a convenient location <netcdf_root>.

Microsoft Compilers

GNU Compilers

In a Cygwin environment that has g95 installed, navigate to the NetCDF directory (here <netcdf_root_cygpath> refers to the location of the NetCDF root in the Cygwin path style. e.g. /cygdrive/c/netcdf-3.6.2).

 cd <netcdf_root_cygpath>

g95 Compiler

 FC=g95 ./configure --prefix=<netcdf_root_cygpath>
 make check
 make install

gfortran Compiler

 FC=gfortran ./configure --prefix=<netcdf_root_cygpath>
 make check
 make install

NB. If the configure phase fails indicating that the f90 compiler is not working then please check that you have installed the Math packages GMP and MPFR into Cygwin.

Building GENIE

I strongly recommend checking out the GENIE code into a directory that does not contain any space characters. We have not tested builds with paths containing spaces, they may or may not work. Life is simpler without the spaces.

Native Microsoft Compilers

GNU Compilers

Edit user.sh

 CODEDIR=/cygdrive/drive_letter/path/to/genie
 OUTROOT=/cygdrive/drive_letter/path/to/output

Edit user.mak (please note that despite being a Windows build this is almost identical to a Linux setup)

 GENIE_ROOT=/cygdrive/drive_letter/path/to/genie
 OUT_DIR=/cygdrive/drive_letter/path/to/output
 F77=g95.exe
 CC=gcc
 CXX=g++
 MACHINE=LINUX
 NETCDF_DIR=<netcdf_root_cygwin>
 NETCDF_NAME=netcdf