I'm going to follow the instructions at CMAQ tutorial build library gcc.
NOTE: It's assumed here that you are at your $HOME
directory.
NOTE: NetCDF must be installed before IOAPI.
- Set environment variables to install NetCDF and create the installation folder.
PATH_TO_APPS=/path/to/apps/directory
NETCDF=$PATH_TO_APPS/NETCDF
export LD_LIBRARY_PATH=$NETCDF/lib:$LD_LIBRARY_PATH
export PATH=$NETCDF/bin:$PATH
1.Download I/O API
git clone https://github.com/cjcoats/ioapi-3.2
- change directories to the ioapi-3.2 directory
cd ioapi-3.2
- Change branches to 20200828 for a tagged stable version
git checkout -b 20200828
- Change directories to the ioapi directory
cd ioapi
- Create copy of Makefile as Makefile.nocpl
cp Makefile.nocpl Makefile
- Set the BIN environment variable to include the loaded module name
export BIN=Linux2_x86_64gfort_openmpi_4.0.3_gcc_9.3.0
- Copy an existing Makeinclude file to have this BIN name at the end
cp Makeinclude.Linux2_x86_64gfort Makeinclude.Linux2_x86_64gfort_openmpi_4.0.3_gcc_9.3.0
- Create a BIN directory where the library and m3tools executables will be installed
mkdir ../$BIN
- Run the make command to compile and link the ioapi library
make |& tee make.log
- Verify that
libioapi.a
library was successfully built
ls -lrt ../$BIN/libioapi.a
- Change directories to the m3tools directory
cd ../m3tools
- Create copy of Makefile as Makefile.nocpl
cp Makefile.nocpl Makefile
- You need to edit line 65 of the
Makefile
to link the NetCDF libraries.
LIBS = -L${OBJDIR} -lioapi `nf-config --flibs` `nc-config --libs` $(OMPLIBS) $(ARCHLIB) $(ARCHLIBS)
- Run the make command to compile m3tools
make |& tee make.log
- Check to see that the
m3tools
have been installed successfully
ls -rlt ../$BIN/m3xtract
- After build, copy the required files to
PATH_TO_APPS
directory.
cd ..
cp -r $BIN $PATH_TO_APPS/IOAPI
rm $PATH_TO_APPS/IOAPI/*.o
cp -r ioapi/fixed_src $PATH_TO_APPS/IOAPI/
cd ..
rm -rf ioapi-3.2