# Library Installation and building ICON

**URL:** <https://forum.cmascenter.org/t/library-installation-and-building-icon/842>\
**Category:** CMAQ-PREP\
**Created:** [July 24, 2019, 10:59pm UTC](https://forum.cmascenter.org/t/library-installation-and-building-icon/842 "2019-07-24T22:59:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![CMAQ\_user](https://avatars.discourse-cdn.com/v4/letter/c/ba8739/32.png) [@CMAQ\_user](https://forum.cmascenter.org/u/CMAQ_user)\
**Post date:** [July 24, 2019, 10:59pm UTC](https://forum.cmascenter.org/t/library-installation-and-building-icon/842/1 "2019-07-24T22:59:11Z")

</div>

Hi,  
can anybody help with what’s wrong with my process (below) toward making CMAQ v5.2 Benchmark case run? currently I am geting ‘undefined reference error’ in ICON.

-compiler flags  
export DIR=/home/somedir/cmaq\_user/model\_libs/library\_cmaq  
export CC=/bin/gcc  
export CPPFLAGS=’-DNDEBUG -DgFortran’  
export CFLAGS=’-O -m64 -mcmodel=medium’  
export FC=gfortran  
export FCFLAGS=’-O -w -m64’  
export F77=/bin/gfortran  
export F90=/bin/gfortran  
export FFLAGS=’-O -w -m64’  
export CXX=/bin/g++  
export CXXFLAGS=’-O -m64 -mcmodel=medium’  
export NCDIR=${DIR}/netcdf

tar zxvf netcdf-c-4.6.3.tar.gz  
cd netcdf-c-4.6.3  
./configure --prefix=$NCDIR --disable-dap   
–disable-netcdf-4 --disable-shared

make check  
make install  
cd …

tar zxvf netcdf-fortran-4.2.tar.gz  
cd netcdf-fortran-4.2  
CPPFLAGS="CPPFLAGS -I{NCDIR}/include"   
LDFLAGS="-L${NCDIR}/lib"   
LD\_LIBRARY\_PATH={NCDIR}/lib \ LIBS="-lnetcdf" \ ./configure --disable-shared --prefix={NCDIR}  
make check  
make install

##### Download and install the ioapi3.2

unset F90  
export BASEDIR=$DIR/ioapi3.2  
mkdir -pv $BASEDIR  
git clone [https://github.com/cjcoats/ioapi-3.2](https://github.com/cjcoats/ioapi-3.2) $BASEDIR  
export BIN=Linux2\_x86\_64gfort\_medium  
export CPLMODE=nocpl  
mkdir $BASEDIR/$BIN  
cp $BASEDIR/ioapi/Makefile.nocpl BASEDIR/ioapi/Makefile sed -i "s|BASEDIR =.\*| BASEDIR = $BASEDIR|" $BASEDIR/ioapi/Makefile  
cp $BASEDIR/m3tools/Makefile.nocpl BASEDIR/m3tools/Makefile sed -i "s|BASEDIR =.\*| BASEDIR = $BASEDIR|" $BASEDIR/m3tools/Makefile

- copy or link the netcdf and netcdff.a libs to BIN cp {NCDIR}/lib/\*.a $BASEDIR/$BIN  
cd $BASEDIR/ioapi  
make  
#make fixed\_src #forCMAQ and SMOKE  
cd $BASEDIR/m3tools  
make

cd -

##### Download and install mpi library

wget -c [http://www.mpich.org/static/downloads/3.2.1/mpich-3.2.1.tar.gz](http://www.mpich.org/static/downloads/3.2.1/mpich-3.2.1.tar.gz)  
tar xzvf mpich-3.2.1.tar.gz  
cd mpich-3.2.1  
./configure --prefix=$DIR/mpich  
make  
make install  
cd -

---

<div class="post-metadata">

**Author:** ![lizadams](https://avatars.discourse-cdn.com/v4/letter/l/49beb7/32.png) [@lizadams](https://forum.cmascenter.org/u/lizadams)\
**Post date:** [September 5, 2019, 8:02pm UTC](https://forum.cmascenter.org/t/library-installation-and-building-icon/842/2 "2019-09-05T20:02:32Z")

</div>

Please include the logfile from your ICON run.  
I would also recommend starting from the CMAQv5.3 release version.

> [@CMAQ version 5.3 Release (August 2019)](https://forum.cmascenter.org/t/cmaq-version-5-3-release-august-2019/887):
>
> Announcing the release of CMAQ version 5.3 (August 2019) The U.S. EPA Office of Research and Development and the Community Modeling and Analysis System Center are pleased to announce the release of CMAQ version 5.3. What’s new in CMAQv5.3? A more detailed representation of the characteristics of PM Expanded chemistry for ozone and PM formation from global-to-local scales More complex land and atmosphere interactions to support both air quality and ecosystems applications New emissions …

---

<div class="post-metadata">

**Author:** ![CMAQ\_user](https://avatars.discourse-cdn.com/v4/letter/c/ba8739/32.png) [@CMAQ\_user](https://forum.cmascenter.org/u/CMAQ_user)\
**Post date:** [September 5, 2019, 9:24pm UTC](https://forum.cmascenter.org/t/library-installation-and-building-icon/842/3 "2019-09-05T21:24:50Z")

</div>

Thank you lizadams for the reply. I resolved this issue.  
Yes I have switched to CMAQv5.3.

By the way, a question:  
Is it possible to run CMAQv5.3 by using older libraries (meaning older netcdf libraries around version 4.6) ? somewhere in the tutorial it says, minimum this version is required (like at least gcc9.1.0, netcdf-c-4.7.0 etc)  
This is because, netcdf-c-4.7.0 never installed with no matter what gcc (tried with gcc9.1.0 also) I tried. However, netcdfc-4.7.1 installed fine with gcc9.1.0 but netcdf-fortran-4.5.0 (or even 4.4.5) is always failing to install.
