Difference between revisions of "GENIE WindowsCompilation"
Genie-user (talk | contribs) |
Genie-user (talk | contribs) |
||
(17 intermediate revisions by 2 users not shown) | |||
Line 3: | Line 3: | ||
===Prerequisites=== | ===Prerequisites=== | ||
+ | In order to build GENIE on a Windows platform you will need to install and configure a suitable environment consisting of | ||
+ | |||
+ | * A linux emulator | ||
+ | * Third party libraries including NetCDF | ||
+ | * A Windows Fortran compiler | ||
+ | * A Windows Linker | ||
+ | |||
The build system is known to work with the following software: | The build system is known to work with the following software: | ||
Line 52: | Line 59: | ||
| | | | ||
|- | |- | ||
− | | rowspan=" | + | | rowspan="4"| GNU Compilers |
− | | Fortran Compiler | + | | rowspan="2"|Fortran Compiler |
| GNU g95 | | GNU g95 | ||
| 0.91 | | 0.91 | ||
+ | | | ||
+ | |- | ||
+ | | GNU gFortran | ||
+ | | 4.3.0 | ||
| | | | ||
|- | |- | ||
Line 75: | Line 86: | ||
Execute the setup program and install Cygwin as directed. | Execute the setup program and install Cygwin as directed. | ||
When asked to select packages please ensure that the following packages are installed: | When asked to select packages please ensure that the following packages are installed: | ||
− | * Base -> bash | + | * Base --> bash |
− | * Devel -> make | + | * Devel --> make |
− | * Interpreters -> python | + | * Devel --> gcc, gcc-core, gcc-g77, gcc-g++, subversion |
− | * Interpreters -> perl (for documentation) | + | * Utils --> diffutils |
+ | * Interpreters --> python | ||
+ | * Interpreters --> perl (for documentation) | ||
+ | * Libs --> libxslt | ||
+ | * gfortran specific requirements | ||
+ | ** Math --> gmp | ||
+ | ** Math --> mpfr | ||
+ | |||
+ | The Cygwin file <code>C:\cygwin\bin\link.exe</code> needs to be moved so that the Visual Studio <code>link.exe</code> linker can be picked up in preference. Alternatively, the Cygwin path would need to be updated to place the Visual Studio linker ahead of the Cygwin default. | ||
+ | |||
+ | <strong>Native Win32 Compiler Configuration</strong> | ||
− | Download g95-x86-cygwin.tgz from ftp.g95.org. | + | <strong>Compaq Visual Fortran</strong> |
+ | |||
+ | We assume that you have a standard installation of the Intel or Compaq Visual Fortran product on your system. In order to make the compiler and linker available at the command line within the Cygwin shell we recommend editing the batch file that launches Cygwin as follows. Edit the file <cygwin>/cygwin.bat (adjusting the paths to the compilers as appropriate): | ||
+ | |||
+ | <pre> | ||
+ | @echo off | ||
+ | |||
+ | call "C:\Program Files\Microsoft Visual Studio\DF98\BIN\DFVARS.BAT" | ||
+ | call "C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\vcvars32.bat" | ||
+ | |||
+ | C: | ||
+ | chdir C:\cygwin\bin | ||
+ | |||
+ | bash --login -i | ||
+ | </pre> | ||
+ | |||
+ | <strong>Intel Visual Fortran</strong> | ||
+ | |||
+ | <pre> | ||
+ | @echo off | ||
+ | |||
+ | call "C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\SetEnv.Cmd" /XP32 /RETAIL | ||
+ | call "C:\Program Files\Intel\Compiler\Fortran\9.1\ia32\Bin\IFortVars.bat" | ||
+ | |||
+ | C: | ||
+ | chdir C:\cygwin\bin | ||
+ | |||
+ | bash --login -i | ||
+ | </pre> | ||
+ | |||
+ | <strong>GNU g95 Compiler Installation</strong> | ||
+ | |||
+ | For up to date details please see [http://ftp.g95.org/#Win http://ftp.g95.org/#Win]. | ||
+ | Download g95-x86-cygwin.tgz from [http://ftp.g95.org/g95-x86-cygwin.tgz http://ftp.g95.org/g95-x86-cygwin.tgz]. | ||
Copy this file to the root of your cygwin distribution. | Copy this file to the root of your cygwin distribution. | ||
In cygwin: | In cygwin: | ||
cd / | cd / | ||
tar zxvf g95-x86-cygwin.tgz | tar zxvf g95-x86-cygwin.tgz | ||
+ | |||
+ | <strong>GNU gFortran Compiler Installation</strong> | ||
+ | |||
+ | For up to date details please see [http://gcc.gnu.org/wiki/GFortranBinariesCygwin 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 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 installation==== | ||
Line 95: | Line 160: | ||
====Microsoft Compilers==== | ====Microsoft Compilers==== | ||
+ | The GENIE framework requires a full installation of the NetCDF library including the C, F77, F90 and C++ interfaces (although the latter is only required for the nightly build tests and can be omitted if these will not be run). The UCAR website does not currently (August 2005) provide pre-built binaries for Win32 satisfying these requirements so we must build the libraries manually. | ||
+ | |||
+ | Download the NetCDF source code from the UCAR website: | ||
+ | |||
+ | [ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf.tar.gz ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf.tar.gz] | ||
+ | |||
+ | Extract the contents of the archive to a local directory. Open the src\win32\NET\netcdf.sln file with Microsoft Visual Studio. Open the Configuration Manager and set the Active Solution to "Release". Highlight the netcdf project and open the properties dialog. Select C/C++ -> Command Line and add the following compiler option in the Additional Options dialog: | ||
+ | |||
+ | /D FCALLSC_QUALIFIER="__declspec(dllexport) __stdcall" | ||
+ | |||
+ | This compiler directive causes the F77 interface to be built in addition to the default C interface. Build the solution and close Visual Studio. | ||
+ | |||
+ | Open a Command Prompt and configure the CVF and the VC++.NET environments (modify the paths to your local installation if necessary): | ||
+ | |||
+ | "C:\Program Files\Microsoft Visual Studio\DF98\BIN\DFVARS.BAT" | ||
+ | "C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\vcvars32.bat" | ||
+ | |||
+ | Navigate to the src\f90 directory and build the F90 library: | ||
+ | |||
+ | Compaq Visual Fortran: | ||
+ | f90.exe /compile_only typeSizes.f90 | ||
+ | f90.exe /compile_only netcdf.f90 | ||
+ | lib /OUT:netcdf_f90.lib typeSizes.obj netcdf.obj | ||
+ | |||
+ | Intel Visual Fortran: | ||
+ | ifort.exe /iface:cvf /compile-only typeSizes.f90 | ||
+ | ifort.exe /iface:cvf /compile-only netcdf.f90 | ||
+ | lib /OUT:netcdf_f90.lib typeSizes.obj netcdf.obj | ||
+ | |||
+ | The Win32 build of the C++ interface is not officially supported by UCAR (at least no specific documentation exists on this). Unfortunately, we require a 'hack' to the code to get the C++ interface to build using Visual Studio. Create a copy of the netcdf.h header file: | ||
+ | |||
+ | copy src\libsrc\netcdf.h src\cxx\netcdf.h | ||
+ | |||
+ | Edit the new copy of netcdf.h in src\cxx and comment out line 199 (line number may vary between releases) | ||
+ | |||
+ | // #define off_t __int64 | ||
+ | |||
+ | Navigate to the src\cxx directory and build the C++ library: | ||
+ | |||
+ | netcdf-3.6.0-p1: | ||
+ | cl.exe /c /O2 /I..\libsrc /DNDEBUG /D "DLL_NETCDF" /EHsc netcdf.cpp | ||
+ | cl.exe /c /O2 /I..\libsrc /DNDEBUG /D "DLL_NETCDF" /EHsc ncvalues.cpp | ||
+ | lib /OUT:netcdf_c++.lib netcdf.obj ncvalues.obj | ||
+ | |||
+ | netcdf-3.6.1: | ||
+ | cl.exe /c /O2 /I..\libsrc /I..\win32\NET /DNDEBUG /D "DLL_NETCDF" /EHsc netcdf.cpp | ||
+ | cl.exe /c /O2 /I..\libsrc /I..\win32\NET /DNDEBUG /D "DLL_NETCDF" /EHsc ncvalues.cpp | ||
+ | lib /OUT:netcdf_c++.lib netcdf.obj ncvalues.obj | ||
+ | |||
+ | Unfortunately, we have to create our own installation. Please create directories and copy files as indicated below. Use the command prompt or Windows Explorer according to preference. | ||
+ | |||
+ | <pre> | ||
+ | cd <netcdf_root> (contains the src folder) | ||
+ | [cut-and-paste should work for the commands below] | ||
+ | |||
+ | mkdir bin | ||
+ | mkdir lib | ||
+ | mkdir include | ||
+ | |||
+ | copy src\win32\NET\Release\netcdf.dll bin\ | ||
+ | copy src\win32\NET\Release\ncdump.exe bin\ | ||
+ | copy src\win32\NET\Release\ncgen.exe bin\ | ||
+ | |||
+ | copy src\win32\NET\Release\netcdf.lib lib\ | ||
+ | copy src\f90\netcdf_f90.lib lib\ | ||
+ | copy "src\cxx\netcdf_c++.lib" lib\ | ||
+ | |||
+ | copy src\libsrc\netcdf.h include\ | ||
+ | copy src\fortran\netcdf.inc include\ | ||
+ | copy src\f90\netcdf.mod include\ | ||
+ | copy src\f90\typeSizes.mod include\ | ||
+ | copy src\cxx\netcdf.hh include\ | ||
+ | copy src\cxx\netcdfcpp.h include\ | ||
+ | copy src\cxx\ncvalues.h include\ | ||
+ | </pre> | ||
====GNU 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). | 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> | cd <netcdf_root_cygpath> | ||
− | + | ||
+ | <strong>g95 Compiler</strong> | ||
+ | |||
+ | FC=g95 ./configure --prefix=<netcdf_root_cygpath> | ||
make check | make check | ||
make install | make install | ||
− | === | + | <strong>gfortran Compiler</strong> |
+ | |||
+ | FC=gfortran CPPFLAGS=-DpgiFortran ./configure --prefix=<netcdf_root_cygpath> | ||
+ | make check | ||
+ | make install | ||
+ | |||
+ | '''NB. If the <code>configure</code> 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.''' | ||
+ | |||
+ | '''If <code>make check</code> fails, try <code>make distclean</code> ,reset your enviroment variables and rerun <code>configure</code>.''' | ||
+ | |||
+ | ===Configuring the GENIE build=== | ||
I strongly recommend checking out the GENIE code into a directory that <em>does not</em> 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. | I strongly recommend checking out the GENIE code into a directory that <em>does not</em> 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==== | ====Native Microsoft Compilers==== | ||
+ | Edit user.sh: | ||
+ | CODEDIR=/cygdrive/drive_letter/path/to/genie | ||
+ | OUTROOT=/cygdrive/drive_letter/path/to/output | ||
+ | |||
+ | Edit user.mak: | ||
+ | GENIE_ROOT=/cygdrive/drive_letter/path/to/genie | ||
+ | OUT_DIR=/cygdrive/drive_letter/path/to/output | ||
+ | |||
+ | Select the appropriate Windows version of the GNU compiler: | ||
+ | Either: | ||
+ | F77=f90.exe | ||
+ | Or: | ||
+ | F77=ifort.exe | ||
+ | |||
+ | And set the other relevant flags | ||
+ | |||
+ | CXX=cl.exe | ||
+ | MACHINE=WIN32 | ||
+ | NETCDF_DIR=E:\\users\\andrew\\netcdf-3.6.0-p1 | ||
+ | NETCDF_NAME=netcdf.lib | ||
+ | |||
+ | Change the path as appropriate for the location of your Win32 NetCDF installation. | ||
====GNU Compilers==== | ====GNU Compilers==== | ||
− | Edit user.sh | + | Edit user.sh: |
CODEDIR=/cygdrive/drive_letter/path/to/genie | CODEDIR=/cygdrive/drive_letter/path/to/genie | ||
OUTROOT=/cygdrive/drive_letter/path/to/output | OUTROOT=/cygdrive/drive_letter/path/to/output | ||
− | Edit user.mak | + | Edit user.mak: |
GENIE_ROOT=/cygdrive/drive_letter/path/to/genie | GENIE_ROOT=/cygdrive/drive_letter/path/to/genie | ||
OUT_DIR=/cygdrive/drive_letter/path/to/output | OUT_DIR=/cygdrive/drive_letter/path/to/output | ||
− | F77=g95 | + | |
+ | Select the appropriate Windows version of the GNU compiler: | ||
+ | Either: | ||
+ | F77=g95.exe | ||
+ | Or: | ||
+ | F77=gfc.exe | ||
+ | |||
+ | And set the other relevant flags (please note that despite being a Windows build this is identical to a Linux setup) | ||
CC=gcc | CC=gcc | ||
CXX=g++ | CXX=g++ | ||
Line 122: | Line 304: | ||
NETCDF_DIR=<netcdf_root_cygwin> | NETCDF_DIR=<netcdf_root_cygwin> | ||
NETCDF_NAME=netcdf | NETCDF_NAME=netcdf | ||
+ | |||
+ | ===Executing the GENIE build=== | ||
+ | Somewhat ironically, the Windows build in Cygwin is not at all forgiving of any Windows CRLF in the scripts it processes. After performing any edits on the files with native Windows tools it is recommended to sanitise the files in genie-main using <code>dos2unix</code>. | ||
+ | |||
+ | dos2unix genie-main/* | ||
+ | dos2unix genie-main/configs/* | ||
+ | |||
+ | At the CygWin bash prompt make sure that the NetCDF DLL and Python are in the system path. If you have installed Cygwin's release of Python then this should already be available on the path, if not then update as follows: | ||
+ | |||
+ | $ export PATH=$PATH:/cygdrive/c/netcdf/bin:/cygdrive/c/Python | ||
+ | |||
+ | It is worth checking that Python can be invoked from the shell and that the version is >1.5.2. To build the binary it should be possible to execute the make command: | ||
+ | |||
+ | $ cd [install-path]/genie-main | ||
+ | $ make | ||
+ | |||
+ | The following warning message will be issued during the final link phase of the Compaq/Intel build: | ||
+ | |||
+ | LINK : warning LNK4044: unrecognized option "module:..\genie-lib\mod"; ignored | ||
+ | |||
+ | This is an expected outcome and does not impact the final production of the GENIE binary. | ||
+ | |||
+ | ===Running GENIE=== | ||
+ | In the Cygwin environment you should find that <code>genie_example.job</code> and <code>make <test_target></code> should work in exactly the same way as in Linux. The XML configuration files should be successfully processed by the version of xsltproc available in Cygwin. | ||
+ | |||
+ | Please note that to run the GENIE binary on a remote system you will need to package up the cygwin1.dll file along with the genie.exe binary and appropriate configuration files. | ||
+ | |||
+ | The MinGW/MSYS shell cannot successfully invoke <code>genie_example.job</code>. Please look at the GENIELab software as an alternative means of managing the binary if you have Matlab available on your system. |
Latest revision as of 14:30, 10 May 2010
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
In order to build GENIE on a Windows platform you will need to install and configure a suitable environment consisting of
- A linux emulator
- Third party libraries including NetCDF
- A Windows Fortran compiler
- A Windows Linker
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 | |
GNU gFortran | 4.3.0 | |||
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
- Devel --> gcc, gcc-core, gcc-g77, gcc-g++, subversion
- Utils --> diffutils
- Interpreters --> python
- Interpreters --> perl (for documentation)
- Libs --> libxslt
- gfortran specific requirements
- Math --> gmp
- Math --> mpfr
The Cygwin file C:\cygwin\bin\link.exe
needs to be moved so that the Visual Studio link.exe
linker can be picked up in preference. Alternatively, the Cygwin path would need to be updated to place the Visual Studio linker ahead of the Cygwin default.
Native Win32 Compiler Configuration
Compaq Visual Fortran
We assume that you have a standard installation of the Intel or Compaq Visual Fortran product on your system. In order to make the compiler and linker available at the command line within the Cygwin shell we recommend editing the batch file that launches Cygwin as follows. Edit the file <cygwin>/cygwin.bat (adjusting the paths to the compilers as appropriate):
@echo off call "C:\Program Files\Microsoft Visual Studio\DF98\BIN\DFVARS.BAT" call "C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\vcvars32.bat" C: chdir C:\cygwin\bin bash --login -i
Intel Visual Fortran
@echo off call "C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\SetEnv.Cmd" /XP32 /RETAIL call "C:\Program Files\Intel\Compiler\Fortran\9.1\ia32\Bin\IFortVars.bat" C: chdir C:\cygwin\bin bash --login -i
GNU g95 Compiler Installation
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 Installation
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
The GENIE framework requires a full installation of the NetCDF library including the C, F77, F90 and C++ interfaces (although the latter is only required for the nightly build tests and can be omitted if these will not be run). The UCAR website does not currently (August 2005) provide pre-built binaries for Win32 satisfying these requirements so we must build the libraries manually.
Download the NetCDF source code from the UCAR website:
ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf.tar.gz
Extract the contents of the archive to a local directory. Open the src\win32\NET\netcdf.sln file with Microsoft Visual Studio. Open the Configuration Manager and set the Active Solution to "Release". Highlight the netcdf project and open the properties dialog. Select C/C++ -> Command Line and add the following compiler option in the Additional Options dialog:
/D FCALLSC_QUALIFIER="__declspec(dllexport) __stdcall"
This compiler directive causes the F77 interface to be built in addition to the default C interface. Build the solution and close Visual Studio.
Open a Command Prompt and configure the CVF and the VC++.NET environments (modify the paths to your local installation if necessary):
"C:\Program Files\Microsoft Visual Studio\DF98\BIN\DFVARS.BAT" "C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\vcvars32.bat"
Navigate to the src\f90 directory and build the F90 library:
Compaq Visual Fortran: f90.exe /compile_only typeSizes.f90 f90.exe /compile_only netcdf.f90 lib /OUT:netcdf_f90.lib typeSizes.obj netcdf.obj
Intel Visual Fortran: ifort.exe /iface:cvf /compile-only typeSizes.f90 ifort.exe /iface:cvf /compile-only netcdf.f90 lib /OUT:netcdf_f90.lib typeSizes.obj netcdf.obj
The Win32 build of the C++ interface is not officially supported by UCAR (at least no specific documentation exists on this). Unfortunately, we require a 'hack' to the code to get the C++ interface to build using Visual Studio. Create a copy of the netcdf.h header file:
copy src\libsrc\netcdf.h src\cxx\netcdf.h
Edit the new copy of netcdf.h in src\cxx and comment out line 199 (line number may vary between releases)
// #define off_t __int64
Navigate to the src\cxx directory and build the C++ library:
netcdf-3.6.0-p1: cl.exe /c /O2 /I..\libsrc /DNDEBUG /D "DLL_NETCDF" /EHsc netcdf.cpp cl.exe /c /O2 /I..\libsrc /DNDEBUG /D "DLL_NETCDF" /EHsc ncvalues.cpp lib /OUT:netcdf_c++.lib netcdf.obj ncvalues.obj
netcdf-3.6.1: cl.exe /c /O2 /I..\libsrc /I..\win32\NET /DNDEBUG /D "DLL_NETCDF" /EHsc netcdf.cpp cl.exe /c /O2 /I..\libsrc /I..\win32\NET /DNDEBUG /D "DLL_NETCDF" /EHsc ncvalues.cpp lib /OUT:netcdf_c++.lib netcdf.obj ncvalues.obj
Unfortunately, we have to create our own installation. Please create directories and copy files as indicated below. Use the command prompt or Windows Explorer according to preference.
cd <netcdf_root> (contains the src folder) [cut-and-paste should work for the commands below] mkdir bin mkdir lib mkdir include copy src\win32\NET\Release\netcdf.dll bin\ copy src\win32\NET\Release\ncdump.exe bin\ copy src\win32\NET\Release\ncgen.exe bin\ copy src\win32\NET\Release\netcdf.lib lib\ copy src\f90\netcdf_f90.lib lib\ copy "src\cxx\netcdf_c++.lib" lib\ copy src\libsrc\netcdf.h include\ copy src\fortran\netcdf.inc include\ copy src\f90\netcdf.mod include\ copy src\f90\typeSizes.mod include\ copy src\cxx\netcdf.hh include\ copy src\cxx\netcdfcpp.h include\ copy src\cxx\ncvalues.h include\
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 CPPFLAGS=-DpgiFortran ./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.
If make check
fails, try make distclean
,reset your enviroment variables and rerun configure
.
Configuring the GENIE build
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
Edit user.sh:
CODEDIR=/cygdrive/drive_letter/path/to/genie OUTROOT=/cygdrive/drive_letter/path/to/output
Edit user.mak:
GENIE_ROOT=/cygdrive/drive_letter/path/to/genie OUT_DIR=/cygdrive/drive_letter/path/to/output
Select the appropriate Windows version of the GNU compiler:
Either: F77=f90.exe Or: F77=ifort.exe
And set the other relevant flags
CXX=cl.exe MACHINE=WIN32 NETCDF_DIR=E:\\users\\andrew\\netcdf-3.6.0-p1 NETCDF_NAME=netcdf.lib
Change the path as appropriate for the location of your Win32 NetCDF installation.
GNU Compilers
Edit user.sh:
CODEDIR=/cygdrive/drive_letter/path/to/genie OUTROOT=/cygdrive/drive_letter/path/to/output
Edit user.mak:
GENIE_ROOT=/cygdrive/drive_letter/path/to/genie OUT_DIR=/cygdrive/drive_letter/path/to/output
Select the appropriate Windows version of the GNU compiler:
Either: F77=g95.exe Or: F77=gfc.exe
And set the other relevant flags (please note that despite being a Windows build this is identical to a Linux setup)
CC=gcc CXX=g++ MACHINE=LINUX NETCDF_DIR=<netcdf_root_cygwin> NETCDF_NAME=netcdf
Executing the GENIE build
Somewhat ironically, the Windows build in Cygwin is not at all forgiving of any Windows CRLF in the scripts it processes. After performing any edits on the files with native Windows tools it is recommended to sanitise the files in genie-main using dos2unix
.
dos2unix genie-main/* dos2unix genie-main/configs/*
At the CygWin bash prompt make sure that the NetCDF DLL and Python are in the system path. If you have installed Cygwin's release of Python then this should already be available on the path, if not then update as follows:
$ export PATH=$PATH:/cygdrive/c/netcdf/bin:/cygdrive/c/Python
It is worth checking that Python can be invoked from the shell and that the version is >1.5.2. To build the binary it should be possible to execute the make command:
$ cd [install-path]/genie-main $ make
The following warning message will be issued during the final link phase of the Compaq/Intel build:
LINK : warning LNK4044: unrecognized option "module:..\genie-lib\mod"; ignored
This is an expected outcome and does not impact the final production of the GENIE binary.
Running GENIE
In the Cygwin environment you should find that genie_example.job
and make <test_target>
should work in exactly the same way as in Linux. The XML configuration files should be successfully processed by the version of xsltproc available in Cygwin.
Please note that to run the GENIE binary on a remote system you will need to package up the cygwin1.dll file along with the genie.exe binary and appropriate configuration files.
The MinGW/MSYS shell cannot successfully invoke genie_example.job
. Please look at the GENIELab software as an alternative means of managing the binary if you have Matlab available on your system.