BRAMS 6.0 - INSTALL PREREQUISITES
Before You install the prerequisites You must have at least one version of gfortran and gcc compiler. The instalation depends of the version of Linux and Kernel You have.
We recomend to install the gfortran revision 8.4.0 and gcc revision 8.4.0. You can install or use newest version of compilers but is by your own risk. You may try to use INTEL, NVIDIA or other compiler too. The strucuture of setup is almost the same.
In most system there are a lot of libraries pre-installed. Yes, if possible use them. But, unfortunatelly, some times a library require other dependencies and the configure may be broken. The instructions bellow in this documents will guide You to install in a particular way. If You got others problems please, contact your system manager.
Create the prerequisites folder's strucuture:
You will need a folder ({YOUR_DIR}) to put the libraries, includes and executables. You can choose a system folder or a local home folder. If You prefer a system folder remember that commands must be preceeded by a sudo command. Another folder ({INSTALL_DIR}) will be used only for create the sctrucuture and can bem erased after all instalation.
mkdir {YOUR_DIR} mkdir {YOUR_DIR}/bin mkdir {YOUR_DIR}/lib mkdir {YOUR_DIR}/include mkdir {INSTALL_DIR} cd {INSTALL_DIR}
example (using system folder /opt/apps as {YOUR_DIR} and user home folder /home/oscar as {INSTALL_DIR}):
sudo mkdir /opt/apps sudo mkdir /opt/apps/bin sudo mkdir /opt/apps/lib sudo mkdir /opt/apps/include mkdir /home/oscar/install cd /home/oscar/install
Download all necessary prerequisites
In order to build full prerequisites a bunch of packages must be downloaded. You can do it in just one command by getting the packages from FTP BRAMS' area or getting every package individually.
To get just one file (easyest way) with all libraries please, get it as show bellow
wget http://ftp.cptec.inpe.br/pesquisa/bramsrd/BRAMS/pre-requisites/prerequisites.tar tar -xvf prerequisites.tar
The necessary packages are:
Package Site File mpich3 http://www.mpich.org/static/downloads/4.0a2/ mpich-4.0a2.tar.gz zlib ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4/ zlib-1.2.8.tar.gz szip ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4/ szip-2.1.tar.gz curl ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4/ curl-7.26.0.tar.gz netCDF C https://downloads.unidata.ucar.edu/netcdf-c/4.8.1/src/ netcdf-c-4.8.1.tar.gz netCDF Fortran https://www.unidata.ucar.edu/downloads/netcdf/ftp/ netcdf-fortran-4.5.3.tar.gz grib2 https://www.ftp.cpc.ncep.noaa.gov/wd51we/wgrib2/ wgrib2.tgz hdf5 https://www.hdfgroup.org/downloads/hdf5/source-code/ hdf5-1.12.1.tar.gz Notice: the grib2 file has diferent names if You get it from NCEP or if You get it from BRAMS ftp.
You must have sure about where are the libraries, includes and binaries You will build the system. Is necessary to make a symbolic link between the gfortran compiler (version 8) of your system using just "gfortran" in your bin area. The same for gcc. Let's setup the paths:
export PATH={YOUR_DIR}/bin:$PATH export LD_LIBRARY_PATH={YOUR_DIR}/lib:$LD_LIBRARY_PATH sudo ln -s /usr/bin/gfortran {YOUR_DIR}/bin/gfortran sudo ln -s /usr/bin/gcc {YOUR_DIR}/bin/gcc
Please, check if Your path have in first part {YOUR_DIR} and if the correct library is in first part of LD_LIBRARY_PATH.
echo $PATH echo $LD_LIBRARY_PATH
Please check if Fortran and gcc version is the correct.
gfortran --version gcc --version
The resulta must be something like. See that in this case we use 8.4.0.
$ gfortran --version GNU Fortran (Ubuntu 8.4.0-4ubuntu1) 8.4.0 Copyright (C) 2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ gcc --version gcc (Ubuntu 8.4.0-4ubuntu1) 8.4.0 Copyright (C) 2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Building the mpich libraries and binaries
Now You must build all libraries one by one. Let's start with mpich
tar -xzvf mpich-4.0a2.tar.gz cd mpich-4.0a2/ ./configure -disable-fast CC=gcc FC=gfortran CFLAGS=-O2 FFLAGS=-O2 CXXFLAGS=-O2 FCFLAGS=-O2 --prefix={YOUR_DIR} --with-device=ch3 make sudo make install cd ..
Building zlib, szip and curl
#zlib tar -xzvf zlib-1.2.8.tar.gz cd zlib-1.2.8/ CC=gcc ./configure --prefix={YOUR_DIR} make sudo make install cd .. #szip tar -xzvf szip-2.1.tar.gz cd szip-2.1/ CC=gcc ./configure --prefix={YOUR_DIR} make sudo make install cd .. #Curl tar -xzvf curl-7.26.0.tar.gz cd curl-7.26.0/ CC=gcc ./configure --prefix={YOUR_DIR} --without-libssh2 make make install cd ..
Building HDF5
tar -xzvf hdf5-1.12.1.tar.gz cd hdf5-1.12.1/ ./configure --prefix={YOUR_DIR} CC={YOUR_DIR}/bin/mpicc FC={YOUR_DIR}/bin/mpif90 --with-zlib={YOUR_DIR}/lib/ --with-szlib={YOUR_DIR}/lib --enable-parallel --enable-fortran make sudo make install cd ..
Building NetCDF libraries
tar -xzvf netcdf-c-4.8.1.tar.gz cd netcdf-c-4.8.1/ CPPFLAGS=-I{YOUR_DIR}/include LDFLAGS=-L{YOUR_DIR}/lib CFLAGS='-O3' CC={YOUR_DIR}/bin/mpicc ./configure --prefix={YOUR_DIR} --enable-netcdf4 --enable-shared --enable-dap make make install cd .. tar -xzvf netcdf-fortran-4.5.3.tar.gz cd netcdf-fortran-4.5.3/ CPPFLAGS=-I{YOUR_DIR}/include LDFLAGS=-L{YOUR_DIR}/lib CFLAGS='-O3' FC={YOUR_DIR}/bin/mpif90 CC={YOUR_DIR}/bin/mpicc ./configure --prefix={YOUR_DIR} make sudo make install cd ..
Building grib2 libraries and API
tar -xzvf grib2.tgz cd grib2 make CC=gcc FC=gfortran make CC=gcc FC=gfortran lib sudo cp wgrib2/wgrib2 {YOUR_DIR}/bin/ sudo cp wgrib2/libwgrib2.a {YOUR_DIR}/lib/ sudo cp ./lib/*.a {YOUR_DIR}/lib/ sudo cp ./lib/*.mod {YOUR_DIR}/include/ cd ..
All the required prerequisites are installed. Have fun!