Cannot build m3tools with mpi support; get super long error

I have successfully built both I/O API and m3tools without PnetCDF/MPI support (using Makeinclude.Linux2_x86_64gfort and Makefile.nocpl). However, to my understanding (please correct me if I’m wrong), I also need to build a version with PnetCDF/MPI support for the CMAQ CCTM. I built libioapi.a with the appropriate Makefile.pncf and Makeinclude.Linux2_x86_64gfortmpi, but when I try to build m3tools with these settings, I get a super long error. I’ve already fixed a ton of stuff which didn’t work (it didn’t helo that I’m totally new to Linux), but this has me stumped.

For context, I’m trying to build I/O API 3.2. I’m on Ubuntu 22.04.3, using GCC compilers (v11.4.0). I installed NetCDF-C (v4.9.2) and NetCDF-Fortran (v4.6.1). I’m also using OpenMPI (v4.1.2).

The Makefile and Makeinclude I use are the following (I would attach the file, but attaching isn’t available to new users):

 #
#.........................................................................
# Version "$Id: Makefile.pncf 233 2023-01-14 18:28:12Z coats $"
# EDSS/Models-3 M3TOOLS
#    (C) 1992-2002 MCNC and Carlie J. Coats, Jr.,
#    (C) 2003-2004 by Baron Advanced Meteorological Systems,
#    (C) 2005-2014, 2017 Carlie J. Coats, Jr., and
#    (C) 2014-2017 UNC Institute for the Environment
# Distributed under the GNU GENERAL PUBLIC LICENSE version 2
# See file "GPL.txt" for conditions of use.
#.........................................................................
#   Makefile for PNetcdf/MPI version of M3Tools
#   Note that I/O API must also have been built for PNetcdf/MPI
#.........................................................................
#  Environment Variables:
#       BIN     machine/OS/compiler/mode type. Shows up as suffix
#               for "Makeinclude.${BIN}" to determine compilation
#               flags, and in ${OBJDIR} and $(INSTALL) to determine
#               binary directories
#       INSTALL installation-directory root, used for "make install":
#               "libioapi.a" and the tool executables will be installed
#               in $(INSTALL)/${BIN}
#
# FOR A ROOT INSTALL (from user "coats" to directory "/opt/bin"):
#
#           make HOME=/home/coats BIN=Linux2_x86_64ifort INSTDIR=/opt/bin install
#            
#.........................................................................
#  Directories:
#       ${BASEDIR}  is the root directory for the I/O API library source,
#                   the M3Tools and M3Test source,the  HTML documentation,
#                   and the (machine/compiler/flag-specific) binary
#                   object/library/executable directories.
#       $(SRCDIR)   is the source directory for the M3TOOLS
#       $(IODIR)    is the source directory for the I/O API library
#       ${OBJDIR}   is the current machine/compiler/flag-specific
#                   build-directory
#       $(F90DIR)   is the current machine/compiler/flag-specific
#                   build-directory for F90-based programs (SGI & Sun)
#.........................................................................
#
#       ---------------     Definitions:   -------------------------

.SUFFIXES: .m4 .c .F .f .f90 .F90

BASEDIR = /home/hector/Software/ioapi-3.2-mpi
SRCDIR  = ${BASEDIR}/m3tools
IODIR   = ${BASEDIR}/ioapi
OBJDIR  = ${BASEDIR}/${BIN}
INSTDIR = ${INSTALL}/${BIN}

# Architecture dependent stuff
# Assumes FC is an f90

include $(IODIR)/Makeinclude.${BIN}

FFLAGS =  -I$(IODIR) ${MODI}$(OBJDIR) $(DEFINEFLAGS) $(FOPTFLAGS) $(ARCHFLAGS)

LDFLAGS = -I$(IODIR) $(DEFINEFLAGS) $(ARCHFLAGS)

#  Incompatibility between netCDF versions before / after v4.1.1:
#  For netCDF v4 and later, you may also need the extra libraries
#  given by netCDF commands
#
#          nc-config --libs
#          nf-config --libs
#
#  Cygwin libraries need "-lnetcdff.dll -lnetcdf.dll" below
#
#LIBS = -L${OBJDIR} -lioapi -lnetcdff -lnetcdf $(PVMLIBS) $(OMPLIBS) $(ARCHLIB) $(ARCHLIBS)
#LIBS = -L${OBJDIR} -lioapi `nf-config --flibs` `nc-config --libs`  $(PVMLIBS) $(OMPLIBS) $(ARCHLIB) $(ARCHLIBS)
#
# PnetCDF builds also require  -lpnetcdf

LIBS = -L${OBJDIR} -lioapi -lnetcdff -lnetcdf -lpnetcdf `nf-config --flibs` `nc-config --libs` $(OMPLIBS) $(ARCHLIB) $(ARCHLIBS)

VPATH = ${OBJDIR}



fSRC = \
agmask.f        agmax.f         airnow2m3.f     airs2m3.f       cdiffstep.f     \
diffstep.f      kfxtract.f      m3agmask.f      m3agmax.f       m3combo.f       \
m3cple.f        m3diff.f        m3edhdr.f       m3hdr.f         m3interp.f      \
m3merge.f       m3pair.f        m3stat.f        m3xtract.f      mtxblend.f      \
mtxbuild.f      mtxcple.f       presterp.f      projtool.f      selmrg2d.f      \
statb.f         statbdry.f      statc.f         statcust.f      statg.f         \
statgrid.f      stati.f         statiddat.f     statm.f         stats.f         \
statspars.f     statstep.f

f90SRC = \
bcwndw.f90      camxtom3.f90    datshift.f90    factor.f90      fakestep.f90    \
fills.f90       findwndw.f90    greg2jul.f90    gregdate.f90    gridprobe.f90   \
insertgrid.f90  jul2greg.f90    juldate.f90     juldiff.f90     julshift.f90    \
latlon.f90      m3fake.f90      m3mask.f90      m3pair.f90      m3probe.f90     \
m3totxt.f90     m3tproc.f90     m3tshift.f90    m3wndw.f90      mpasdiff.f90    \
mpasstat.f90    mpastom3.f90    mtxcalc.f90     pairstep.f90    presz.f90       \
randomstat.f90  timediff.f90    timeshift.f90   vertot.f90      vertimeproc.f90 \
vertintegral.f90                wndwdesc.f90    wndwpoints.f90  wndwptdata.f90  \
wrfgriddesc.f90 wrftom3.f90     wrfwndw.f90


OBJ = $(fSRC:.f=.o) $(f90SRC:.f90=.o)

EXE = \
airs2m3         bcwndw          camxtom3        datshift        dayagg          \
factor          findwndw        greg2jul        gregdate        gridprobe       \
insertgrid      jul2greg        juldate         juldiff         julshift        \
kfxtract        latlon          m3agmax         m3agmask        m3cple          \
m3combo         m3diff          m3edhdr         m3fake          m3hdr           \
m3interp        m3mask          m3merge         m3pair          m3probe         \
m3stat          m3totxt         m3tproc         m3tshift        m3wndw          \
m3xtract        mtxblend        mtxbuild        mtxcalc         mtxcple         \
mpasdiff        mpasstat        mpastom3        presterp        presz           \
projtool        randomstat      selmrg2d        timediff        timeshift       \
vertot          vertimeproc     vertintegral    wndwdesc        wndwpoints      \
wndwptdata      wrfgriddesc     wrftom3         wrfwndw



#      ----------------------   TOP-LEVEL TARGETS:   ------------------

all: $(EXE)

clean:
	cd ${OBJDIR}; rm $(EXE) $(OBJ)

install: $(INSTDIR)
	echo "Installing M3TOOLS in ${INSTDIR}"
	cd ${OBJDIR}; cp $(EXE) $(INSTDIR)

rmexe:
	cd ${OBJDIR}; rm $(EXE)

relink:
	make BIN=${BIN} -i rmexe ; make BIN=${BIN} all

bins:
	make BIN=Linux2_x86_64
	make BIN=Linux2_x86_64sun
	make BIN=Linux2_x86_64ifort
	make BIN=Linux2_x86_64dbg
	make BIN=Linux2_x86_64sundbg
	make BIN=Linux2_x86_64ifortdbg

binclean:
	make -i BIN=Linux2_x86_64          clean
	make -i BIN=Linux2_x86_64sun       clean
	make -i BIN=Linux2_x86_64ifort     clean
	make -i BIN=Linux2_x86_64dbg       clean
	make -i BIN=Linux2_x86_64sundbg    clean
	make -i BIN=Linux2_x86_64ifortdbg  clean


binrelink:
	make BIN=Linux2_x86_64         relink
	make BIN=Linux2_x86_64sun      relink
	make BIN=Linux2_x86_64ifort    relink
	make BIN=Linux2_x86_64dbg      relink
	make BIN=Linux2_x86_64sundbg   relink
	make BIN=Linux2_x86_64ifortdbg relink

flags:
	echo "BIN=${BIN}"
	echo "FFLAGS=$(FFLAGS)"
	echo "LDFLAGS=$(LDFLAGS)"
	echo "LIBS=$(LIBS)"
	echo "ARCHFLAGS=$(ARCHFLAGS)"
	echo "ARCHLIB=$(ARCHLIB)"
	echo "ARCHLIBS=$(ARCHLIBS)"
	echo "OMPFLAGS=$(OMPFLAGS)"
	echo "OMPLIBS=$(OMPLIBS)"
	echo "FOPTFLAGS=$(FOPTFLAGS)"
	echo "COPTFLAGS=$(COPTFLAGS)"
	echo "PARFLAGS=$(PARFLAGS)"
	echo "PVM_ROOT=$(PVM_ROOT)"
	echo "PVMLIBS=$(PVMLIBS)"


#      -----------------------   RULES:   -------------------------

%.o : %.mod        #  Disable "gmake"s obnoxious implicit Modula-2 rule !!
%.f : %.F          #  Hack for some versions of  "gmake" + "gfortran"

.F.o:
	cd ${OBJDIR}; $(FC) $(FPPFLAGS) $(FFLAGS) -c $(SRCDIR)/$<


.f.o:
	cd ${OBJDIR}; $(FC) $(FFLAGS) -c $(SRCDIR)/$<


.f90.o:
	cd ${OBJDIR}; $(FC) $(FFLAGS) -c $(SRCDIR)/$<

#  ---------------------------  Dependencies:  --------------------

aggvars.o       : m3utilio.mod
agmask.o        : m3utilio.mod
agmax.o         : m3utilio.mod
airnow2m3.o     : m3utilio.mod
airs2m3.o       : m3utilio.mod
cdiffstep.o     : m3utilio.mod
dayagg.o        : m3utilio.mod
diffstep.o      : m3utilio.mod
aggvars.o       : m3utilio.mod
agmask.o        : m3utilio.mod
agmax.o         : m3utilio.mod
airnow2m3.o     : m3utilio.mod
airs2m3.o       : m3utilio.mod
cdiffstep.o     : m3utilio.mod
dayagg.o        : m3utilio.mod
diffstep.o      : m3utilio.mod
gridprobe.o     : m3utilio.mod  modgctp.mod
insertgrid.o    : m3utilio.mod  modgctp.mod
latlon.o        : m3utilio.mod  modgctp.mod
m3agmask.o      : m3utilio.mod
m3agmax.o       : m3utilio.mod
m3combo.o       : m3utilio.mod  modatts3.mod
m3cple.o        : m3utilio.mod  modgctp.mod modatts3.mod
m3diff.o        : m3utilio.mod
m3edhdr.o       : m3utilio.mod
m3hdr.o         : m3utilio.mod  modatts3.mod
m3interp.o      : m3utilio.mod  modgctp.mod modatts3.mod
m3mask.o        : m3utilio.mod
m3merge.o       : m3utilio.mod  modgctp.mod
m3stat.o        : m3utilio.mod
m3tproc.o       : m3utilio.mod  modatts3.mod
m3tshift.o      : m3utilio.mod  modatts3.mod
m3xtract.o      : m3utilio.mod  modatts3.mod
m3wndw.o        : m3utilio.mod  modatts3.mod
mpasdiff.o      : m3utilio.mod  modmpasfio.mod
mpasstat.o      : m3utilio.mod  modmpasfio.mod
mpastom3.o      : m3utilio.mod  modmpasfio.mod
mtxbuild.o      : m3utilio.mod  modatts3.mod
mtxcalc.o       : m3utilio.mod  modatts3.mod modgctp.mod
mtxcple.o       : m3utilio.mod  modatts3.mod
projtool.o      : m3utilio.mod  modgctp.mod
selmrg2d.o      : m3utilio.mod
statbdry.o      : m3utilio.mod
statcust.o      : m3utilio.mod
statgrid.o      : m3utilio.mod
statiddat.o     : m3utilio.mod
statspars.o     : m3utilio.mod
wndwdesc.o      : m3utilio.mod  modgctp.mod
wndwpoints.o    : m3utilio.mod  modgctp.mod
wndwptdata.o    : m3utilio.mod  modgctp.mod
wrfgriddesc.o   : m3utilio.mod  modwrfio.mod
wrftom3.o       : m3utilio.mod  modwrfio.mod
wrfwndw.o       : m3utilio.mod  modwrfio.mod modncfio.mod modgctp.mod


#  ---------------------------  $(EXE) Program builds:  -----------------


airs2m3:  airs2m3.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

bcwndw: bcwndw.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

camxtom3:  camxtom3.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

datshift:  datshift.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

dayagg: dayagg.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

factor:  factor.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

findwndw:  findwndw.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

greg2jul: greg2jul.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

gregdate: gregdate.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

gridprobe: gridprobe.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

insertgrid:  insertgrid.o
	cd ${OBJDIR}; ${FC} ${LFLAGS} $^ ${LIBS} -o $@

jul2greg:  jul2greg.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

juldate:  juldate.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

juldiff:  juldiff.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

julshift:  julshift.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

kfxtract: kfxtract.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

latlon:  latlon.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

m3agmask:  m3agmask.o agmask.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

m3agmax:  m3agmax.o agmax.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

m3combo: m3combo.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

m3cple: m3cple.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

m3diff:  m3diff.o diffstep.o cdiffstep.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

m3edhdr:  m3edhdr.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

m3fake: m3fake.o fakestep.o fills.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

m3hdr:  m3hdr.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

m3interp: m3interp.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

m3mask: m3mask.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

m3merge: m3merge.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

m3pair:  m3pair.o pairstep.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

m3probe: m3probe.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

m3stat: m3stat.o statbdry.o statcust.o statgrid.o statiddat.o statspars.o \
        statb.o  statc.o statg.o stati.o statm.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

m3totxt:  m3totxt.o
	cd ${OBJDIR}; ${FC} ${LFLAGS} $^ ${LIBS} -o $@

m3tproc:  m3tproc.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

m3tshift:  m3tshift.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

m3wndw: m3wndw.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

m3xtract:  m3xtract.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

m4cple: m4cple.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

mpasdiff: mpasdiff.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

mpasstat: mpasstat.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

mpastom3: mpastom3.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

mtxblend: mtxblend.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

mtxbuild: mtxbuild.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

mtxcalc: mtxcalc.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

mtxcple: mtxcple.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

presterp: presterp.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

presz:  presz.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

projtool: projtool.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

randomstat:  randomstat.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

selmrg2d:  selmrg2d.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

sfcmet:  sfcmet.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

timediff: timediff.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

timeshift: timeshift.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

vertimeproc:  vertimeproc.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

vertintegral:  vertintegral.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

vertot:  vertot.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

wndwdesc:  wndwdesc.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

wndwpoints:  wndwpoints.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

wndwptdata:  wndwptdata.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

wrfgriddesc:  wrfgriddesc.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

wrftom3:  wrftom3.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@

wrfwndw:  wrfwndw.o
	cd ${OBJDIR}; $(FC) ${LFLAGS} $^ ${LIBS} -o $@
# Version "$Id: Makeinclude.Linux2_x86_64gfortmpi 1 2017-06-10 18:05:20Z coats $"
#
#  Build MPI/PnetCDF distributed-file support using "mpif90" and "mpcc",
#  where compilers are built "on top of" Gnu compilers
#
#  12/2013 by CJC: Conditional preprocessor-code "-DNEED_ARGS=1"
#  to implement  IARGC() and GETARG() for compilers
#  ("gfortran" version 4.8 or later to be exact) that insist on
#  enforcing F2003-only with no backwards nor industry-standards compatibility.
#
#  Remove "-DNEED_ARGS=1" from ARCHFLAGS for version 4.7.x and earlier
#
# Use "-march=native -mtune=native" if compile-platform and compute-platform
# are the same.
# Use "-Wall -Wsurprising" for full diagnostics.
#
#  08/2020 by CJC: gfortran version 10 requires Fortran-flag
#
#        -fallow-argument-mismatch
#
#  to deal with its idiosyncratic interpretation of the Fortran-2018 Standard.
#  See the "Makeinclude.Linux2_x86_64gfort10*" files for how to do this...

AR   = ar
CC   = mpicc
CXX  = mpiCC
FC   = mpif90
M4   = m4
LINK = $(CC)

## Module-include-directory command
MODI = -I
E132 = -ffixed-line-length-132

MFLAGS    = -ffast-math -funroll-loops -m64  #  -Wall -Wsurprising -march=native -mtune=native

OMPFLAGS  = -fopenmp
OMPLIBS   = -fopenmp
COPTFLAGS = -O3 ${MFLAGS}
FOPTFLAGS = -O3 -fallow-argument-mismatch ${MFLAGS}
FPPFLAGS  = -DF90=1 -DIOAPI_PNCF=1
FSFLAGS   = -fno-automatic
ARCHFLAGS = \
 -DAUTO_ARRAYS=1 \
 -DF90=1 -DFLDMN=1 \
 -DFSTR_L=int \
 -DIOAPI_NO_STDOUT=1 \
 -DNEED_ARGS=1
PARFLAGS  =
ARCHLIB   = -dynamic -L/usr/lib64 -lm -lpthread -lc

M4DEFFILE = $(PVM_ROOT)/conf/$(PVM_ARCH).m4
PVMLIBS   = -lpvm3

When I type ‘make’ I get a super long error, which I will paste here in it’s entirety since it’s basically the same thing over and over again, but the jist is:

cd /home/hector/Software/ioapi-3.2-mpi/Linux2_x86_64gfortmpi; mpif90  /home/hector/Software/ioapi-3.2-mpi/Linux2_x86_64gfortmpi/airs2m3.o -L/home/hector/Software/ioapi-3.2-mpi/Linux2_x86_64gfortmpi -lioapi -lnetcdff -lnetcdf -lpnetcdf `nf-config --flibs` `nc-config --libs` -fopenmp -dynamic -L/usr/lib64 -lm -lpthread -lc  -o airs2m3
/usr/bin/ld: /home/hector/Software/ioapi-3.2-mpi/Linux2_x86_64gfortmpi/libioapi.a(init3.o): in function `init3_':
init3.F90:(.text+0x32b): undefined reference to `nfmpi_inq_libvers_'
/usr/bin/ld: /home/hector/Software/ioapi-3.2-mpi/Linux2_x86_64gfortmpi/libioapi.a(open3.o): in function `open3_':
open3.F90:(.text+0x1364): undefined reference to `nfmpi_close_'
/usr/bin/ld: /home/hector/Software/ioapi-3.2-mpi/Linux2_x86_64gfortmpi/libioapi.a(opnlog3.o): in function `opnlog3_':
opnlog3.F90:(.text+0x199a): undefined reference to `nfmpi_get_att_text_'
/usr/bin/ld: /home/hector/Software/ioapi-3.2-mpi/Linux2_x86_64gfortmpi/libioapi.a(pn_crtfil3.o): in function `pn_crtfil3_':
pn_crtfil3.F90:(.text+0x7d0): undefined reference to `nfmpi_create_'
/usr/bin/ld: pn_crtfil3.F90:(.text+0x854): undefined reference to `nfmpi_close_'
/usr/bin/ld: pn_crtfil3.F90:(.text+0x9ad): undefined reference to `nfmpi_put_att_text_'
/usr/bin/ld: pn_crtfil3.F90:(.text+0xa6c): undefined reference to `nfmpi_put_att_text_'
/usr/bin/ld: pn_crtfil3.F90:(.text+0xaf9): undefined reference to `nfmpi_put_att_int_'
/usr/bin/ld: pn_crtfil3.F90:(.text+0xb6d): undefined reference to `nfmpi_put_att_int_'
/usr/bin/ld: pn_crtfil3.F90:(.text+0xbe2): undefined reference to `nfmpi_put_att_int_'
/usr/bin/ld: pn_crtfil3.F90:(.text+0xc55): undefined reference to `nfmpi_put_att_int_'
/usr/bin/ld: pn_crtfil3.F90:(.text+0xcc7): undefined reference to `nfmpi_put_att_int_'
/usr/bin/ld: /home/hector/Software/ioapi-3.2-mpi/Linux2_x86_64gfortmpi/libioapi.a(pn_crtfil3.o):pn_crtfil3.F90:(.text+0xd97): more undefined references to `nfmpi_put_att_int_' follow
/usr/bin/ld: /home/hector/Software/ioapi-3.2-mpi/Linux2_x86_64gfortmpi/libioapi.a(pn_crtfil3.o): in function `pn_crtfil3_':
pn_crtfil3.F90:(.text+0x1290): undefined reference to `nfmpi_put_att_double_'
/usr/bin/ld: pn_crtfil3.F90:(.text+0x1321): undefined reference to `nfmpi_put_att_double_'
/usr/bin/ld: pn_crtfil3.F90:(.text+0x13b1): undefined reference to `nfmpi_put_att_double_'
/usr/bin/ld: pn_crtfil3.F90:(.text+0x1440): undefined reference to `nfmpi_put_att_double_'
/usr/bin/ld: pn_crtfil3.F90:(.text+0x14d1): undefined reference to `nfmpi_put_att_double_'
/usr/bin/ld: /home/hector/Software/ioapi-3.2-mpi/Linux2_x86_64gfortmpi/libioapi.a(pn_crtfil3.o):pn_crtfil3.F90:(.text+0x1561): more undefined references to `nfmpi_put_att_double_' follow
/usr/bin/ld: /home/hector/Software/ioapi-3.2-mpi/Linux2_x86_64gfortmpi/libioapi.a(pn_crtfil3.o): in function `pn_crtfil3_':
pn_crtfil3.F90:(.text+0x1784): undefined reference to `nfmpi_put_att_int_'
/usr/bin/ld: pn_crtfil3.F90:(.text+0x1812): undefined reference to `nfmpi_put_att_real_'
/usr/bin/ld: pn_crtfil3.F90:(.text+0x18c1): undefined reference to `nfmpi_put_att_real_'
/usr/bin/ld: pn_crtfil3.F90:(.text+0x1988): undefined reference to `nfmpi_put_att_text_'
/usr/bin/ld: pn_crtfil3.F90:(.text+0x1a15): undefined reference to `nfmpi_put_att_text_'
/usr/bin/ld: pn_crtfil3.F90:(.text+0x1a72): undefined reference to `nfmpi_put_att_text_'
/usr/bin/ld: pn_crtfil3.F90:(.text+0x1aad): undefined reference to `nfmpi_put_att_text_'
/usr/bin/ld: pn_crtfil3.F90:(.text+0x1bf1): undefined reference to `nfmpi_put_att_text_'
/usr/bin/ld: pn_crtfil3.F90:(.text+0x1c56): undefined reference to `nfmpi_def_dim_'
/usr/bin/ld: pn_crtfil3.F90:(.text+0x1cee): undefined reference to `nfmpi_def_dim_'
/usr/bin/ld: pn_crtfil3.F90:(.text+0x1d64): undefined reference to `nfmpi_def_dim_'
/usr/bin/ld: pn_crtfil3.F90:(.text+0x1dde): undefined reference to `nfmpi_def_dim_'
/usr/bin/ld: pn_crtfil3.F90:(.text+0x1ee4): undefined reference to `nfmpi_def_var_'
/usr/bin/ld: pn_crtfil3.F90:(.text+0x1f57): undefined reference to `nfmpi_put_att_text_'
/usr/bin/ld: pn_crtfil3.F90:(.text+0x1fde): undefined reference to `nfmpi_put_att_text_'
/usr/bin/ld: pn_crtfil3.F90:(.text+0x204d): undefined reference to `nfmpi_put_att_text_'
/usr/bin/ld: pn_crtfil3.F90:(.text+0x20e4): undefined reference to `nfmpi_def_dim_'
/usr/bin/ld: pn_crtfil3.F90:(.text+0x2152): undefined reference to `nfmpi_def_dim_'
/usr/bin/ld: pn_crtfil3.F90:(.text+0x22d0): undefined reference to `nfmpi_def_var_'
/usr/bin/ld: pn_crtfil3.F90:(.text+0x2308): undefined reference to `nfmpi_put_att_text_'
/usr/bin/ld: pn_crtfil3.F90:(.text+0x233f): undefined reference to `nfmpi_put_att_text_'
/usr/bin/ld: pn_crtfil3.F90:(.text+0x2384): undefined reference to `nfmpi_put_att_text_'
/usr/bin/ld: pn_crtfil3.F90:(.text+0x2464): undefined reference to `nfmpi_enddef_'
/usr/bin/ld: pn_crtfil3.F90:(.text+0x285f): undefined reference to `nfmpi_abort_'
/usr/bin/ld: pn_crtfil3.F90:(.text+0x29ab): undefined reference to `nfmpi_sync_'
/usr/bin/ld: /home/hector/Software/ioapi-3.2-mpi/Linux2_x86_64gfortmpi/libioapi.a(pn_opnfil3.o): in function `pn_opnfil3_':
pn_opnfil3.F90:(.text+0xcb): undefined reference to `nfmpi_open_'
/usr/bin/ld: pn_opnfil3.F90:(.text+0x170): undefined reference to `nfmpi_close_'
/usr/bin/ld: pn_opnfil3.F90:(.text+0x1f2): undefined reference to `nfmpi_get_att_int_'
/usr/bin/ld: pn_opnfil3.F90:(.text+0x4b2): undefined reference to `nfmpi_get_att_int_'
/usr/bin/ld: pn_opnfil3.F90:(.text+0x50d): undefined reference to `nfmpi_get_att_int_'
/usr/bin/ld: pn_opnfil3.F90:(.text+0x609): undefined reference to `nfmpi_get_att_int_'
/usr/bin/ld: pn_opnfil3.F90:(.text+0x67f): undefined reference to `nfmpi_get_att_int_'
/usr/bin/ld: /home/hector/Software/ioapi-3.2-mpi/Linux2_x86_64gfortmpi/libioapi.a(pn_opnfil3.o):pn_opnfil3.F90:(.text+0x6f7): more undefined references to `nfmpi_get_att_int_' follow
/usr/bin/ld: /home/hector/Software/ioapi-3.2-mpi/Linux2_x86_64gfortmpi/libioapi.a(pn_opnfil3.o): in function `pn_opnfil3_':
pn_opnfil3.F90:(.text+0xa20): undefined reference to `nfmpi_get_att_double_'
/usr/bin/ld: pn_opnfil3.F90:(.text+0xa91): undefined reference to `nfmpi_get_att_double_'
/usr/bin/ld: pn_opnfil3.F90:(.text+0xb04): undefined reference to `nfmpi_get_att_double_'


[...]

/usr/bin/ld: /home/hector/Software/ioapi-3.2-mpi/Linux2_x86_64gfortmpi/libioapi.a(wratt3.o): in function `master.0.wratt3_':
wratt3.F90:(.text+0x17eb): undefined reference to `nfmpi_redef_'
/usr/bin/ld: wratt3.F90:(.text+0x1875): undefined reference to `nfmpi_put_att_int8_'
/usr/bin/ld: wratt3.F90:(.text+0x1b12): undefined reference to `nfmpi_put_att_double_'
/usr/bin/ld: wratt3.F90:(.text+0x1b5a): undefined reference to `nfmpi_put_att_real_'
/usr/bin/ld: wratt3.F90:(.text+0x1ba4): undefined reference to `nfmpi_put_att_int_'
/usr/bin/ld: wratt3.F90:(.text+0x1bf0): undefined reference to `nfmpi_put_att_text_'
/usr/bin/ld: /home/hector/Software/ioapi-3.2-mpi/Linux2_x86_64gfortmpi/libioapi.a(wrtflag.o): in function `wrtflag_':
wrtflag.F90:(.text+0xa05): undefined reference to `nfmpi_put_vara_int_'
collect2: error: ld returned 1 exit status
make: *** [Makefile:257: airs2m3] Error 1

Anything which might help be get unstuck would be really greatly appreciated as I’ve been stuck for a while and I’m starting to wonder if I’ll ever get CMAQ up and running for my research. Thanks in advance!

The errors are simple: you need the MPI libraries as part of the libraries for your build.

HOWEVER. You don’t need to do this: the parallel-netCDF libraries called by the PnetCDF/MPI-enabled CMAQ CCTM generate the same underlying file-format as “normal” netCDF, and can be read by the programs from a "normal"m3tools build.

See https://cjcoats.github.io/ioapi/AVAIL.html#build:

5.I/O API 3.2 only:

1. **You will want to build both**, since the PnetCDF enabled libraries are for the CMAQ CCTM only.
1 Like

Thanks! This really was a huge help.