# Ifort compiles IOAPI-3.2 with netcdf4

**URL:** <https://forum.cmascenter.org/t/ifort-compiles-ioapi-3-2-with-netcdf4/1456>\
**Category:** I/O API\
**Created:** [April 27, 2020, 8:52pm UTC](https://forum.cmascenter.org/t/ifort-compiles-ioapi-3-2-with-netcdf4/1456 "2020-04-27T20:52:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kjliao](https://avatars.discourse-cdn.com/v4/letter/k/e5b9ba/32.png) [@kjliao](https://forum.cmascenter.org/u/kjliao)\
**Post date:** [April 27, 2020, 8:52pm UTC](https://forum.cmascenter.org/t/ifort-compiles-ioapi-3-2-with-netcdf4/1456/1 "2020-04-27T20:52:16Z")

</div>

I used ifort to compiled IOAPI-3.2. netcdf4 is used. When I typed “make BIN=Linux2\_x86\_64ifort”, I got the following error message. Any suggestions to solve the problem? Thanks!

# ============ ld: cannot find -lnetcdff ld: cannot find -lnetcdf make[1]: \*\*\* [airs2m3] Error 1 make[1]: Leaving directory `/home/kliao/ioapi-3.2/m3tools’ make: \*\*\* [all] Error 2

In my Makefile, NCFLIBS = -lnetcdff -lnetcdf.

---

<div class="post-metadata">

**Author:** ![cjcoats](https://avatars.discourse-cdn.com/v4/letter/c/ac8455/32.png) [@cjcoats](https://forum.cmascenter.org/u/cjcoats)\
**Post date:** [April 27, 2020, 9:20pm UTC](https://forum.cmascenter.org/t/ifort-compiles-ioapi-3-2-with-netcdf4/1456/2 "2020-04-27T21:20:53Z")

</div>

See Paragraph 8 in the I/O API build instructions [https://cjcoats.github.io/ioapi/AVAIL.html#build](https://cjcoats.github.io/ioapi/AVAIL.html#build) on the Availability/Download/Installation page:

> Acquire and build the netCDF library, libnetcdf.a (and libnetcdff.a for netCDF-4.1 or later), for each configuration. The netCDF home page is [Unidata | NetCDF](https://www.unidata.ucar.edu/software/netcdf/) For each configuration,copy or link the resulting libnetcdf.a (and libnetcdff.a, if you’re building netCDF version 4.1 or later) to the appropriate object directory `$BASEDIR/${BIN}` .  
> See [NOTES on netCDF-4](https://cjcoats.github.io/ioapi/AVAIL.html#ncf4) for configuring netCDF-4.
> 
> **For I/O API-3.2 and netCDF-4:** Some configurations of netCDF-4 have `INTEGER*8` (64-bit integer) support, and some do not; the I/O API tries to make it possible to use this support if it is available, but needs to include “hacks” to cover for its absence when it isn’t. You can find out if it is included in netCDF using the command
> 
> nm libnetcdff.a | grep nf\_get\_var\_int64\_
> 
> If present, you need to add the definition `-DIOAPI_NCF4=1` to the make-variable `ARCHFLAGS` in your `MAKEINCLUDE.${BIN}` . Otherewise, you will get “multiply defined symbol” errors when you attempt to compile programs.
> 
> For I/O API-3.2, if you are building the PnetCDF/MPI distributed-I/O version for CMAQ, then install the appropriate MPI development package, and download PnetCDF from [https://trac.mcs.anl.gov/projects/parallel-netcdf/wiki/Download](https://trac.mcs.anl.gov/projects/parallel-netcdf/wiki/Download) then build and install libpnetcdf.a and copy or link it to the appropriate object directory.  
> Note that to a very large extent, **different MPI implementations are not compatible** : Intel MPI does not play well with OpenMPI does not play well with MPICH does not play well with MVAPICH… ;-(

If you plan to build a [coupling-mode configuration](https://cjcoats.github.io/ioapi/BUFFERED.html#pvm), do the same with PVM’s libpvm3.a. See [PVM: Parallel Virtual Machine](http://www.csm.ornl.gov/pvm/pvm_home.html) (Only the C interface to PVM is used; the resulting library tends to be more compiler-independent than for netCDF, where both C and Fortran interfaces are used.)
