# Encountering errors during MPAS-CMAQ compilation

**URL:** <https://forum.cmascenter.org/t/encountering-errors-during-mpas-cmaq-compilation/5405>\
**Category:** MPAS-CMAQ\
**Tags:** cmaq\
**Created:** [December 4, 2024, 3:34am UTC](https://forum.cmascenter.org/t/encountering-errors-during-mpas-cmaq-compilation/5405 "2024-12-04T03:34:37Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![penguin](https://avatars.discourse-cdn.com/v4/letter/p/e480ec/32.png) [@penguin](https://forum.cmascenter.org/u/penguin)\
**Post date:** [December 4, 2024, 3:34am UTC](https://forum.cmascenter.org/t/encountering-errors-during-mpas-cmaq-compilation/5405/1 "2024-12-04T03:34:37Z")

</div>

Hello! I have recently been trying to install and compile MPAS-CMAQ. There are others on the server where I am who have attempted to install MPAS and have installed all the necessary libraries, which I have accessed.

```auto
module purge
module load intel/18.0.0
export LIB=/share/MODEL/MPAS/intel/apps
#mpich
export MPI=${LIB}/mpich
export PATH=${MPI}/bin:$PATH
export LD_LIBRARY_PATH=${MPI}/lib:$LD_LIBRARY_PATH
export INCLUDE=${MPI}/include:$INCLUDE

#zlib
export ZLIB=${LIB}/zlib
export LD_LIBRARY_PATH=${ZLIB}/lib:$LD_LIBRARY_PATH
export INCLUDE=${ZLIB}/include:$INCLUDE

#szip
export SZIP=${LIB}/szip
export LD_LIBRARY_PATH=${SZIP}/lib:$LD_LIBRARY_PATH
export INCLUDE=${SZIP}/include:$INCLUDE

#hdf5
export HDF5=${LIB}/HDF5
export PATH=${HDF5}/bin:$PATH
export LD_LIBRARY_PATH=${HDF5}/lib:$LD_LIBRARY_PATH
export INCLUDE=${HDF5}/include:$INCLUDE

#pnetcdf
export PNETCDF=${LIB}/PnetCDF
export PATH=${PNETCDF}/bin:$PATH
export LD_LIBRARY_PATH=${PNETCDF}/lib:$LD_LIBRARY_PATH
export INCLUDE=${PNETCDF}/include:$INCLUDE

#netcdf
export NETCDF=${LIB}/netcdf
export PATH=${NETCDF}/bin:$PATH
export LD_LIBRARY_PATH=${NETCDF}/lib:$LD_LIBRARY_PATH
export INCLUDE=${NETCDF}/include:$INCLUDE

#pio
export PIO=${LIB}/pio
export LD_LIBRARY_PATH=${PIO}/lib:$LD_LIBRARY_PATH
export INCLUDE=${PIO}/include:$INCLUDE
export USE_PIO2=true

#cmake
export CMAKE=${LIB}/cmake
export PATH=${CMAKE}/bin:$PATH

```

Although the versions of the libraries do not completely match those mentioned in your post about `iolib_installation.sh`, I believe they should be compatible. However, as I followed the installation guide,

```auto
git clone -b MPAS_CMAQ https://github.com/USEPA/CMAQ.git CMAQ_REPO
cd CMAQ_REPO
vi bldit_project.csh
set CMAQ_HOME = /share/home/wjd/panting/MPASCMAQ/CMAQ_5.5
./bldit_project.csh
cd /share/home/wjd/panting/MPASCMAQ/CMAQ_5.5/CCTM/scripts
./bldit_cctm.csh intel

git clone -b MPAS7.0 git@github.com:USEPA/MPAS.git MPAS

cp -r /share/home/wjd/panting/MPASCMAQ/CMAQ_5.5/CCTM/scripts/BLD_CCTM_v55_intel_cracmm2_m3dry /share/home/wjd/panting/MPASCMAQ/MPAS/src/core_atmosphere/cmaq
make intel CORE=atmosphere USE_PIO2=true

```

I encountered the following error message.

 ![图片](https://canada1.discourse-cdn.com/flex027/uploads/cmas/original/2X/4/470dd0b6f6029e4627ebe652e53f2197d1decd12.png)

What could be the cause of this error? Is the installation process not as straightforward as it seems, and do I need to make changes to files such as `config_cmaq.csh` for CMAQ or the `Makefile` for MPAS?

---

<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:** [December 4, 2024, 2:48pm UTC](https://forum.cmascenter.org/t/encountering-errors-during-mpas-cmaq-compilation/5405/2 "2024-12-04T14:48:57Z")

</div>

I also encountered this failure in the test of building the pio2.out. To work around it, I commented out the rm pio.f90 in the Makefile and compiled this program by hand.

```auto
pio_test:
..

```

```
    @($(FC) pio1.f90 -ffixed-line-length-132 $(FCINCLUDES) $(FFLAGS) $(LDFLAGS) $(LIBS) -o pio1.out &> /dev/null && echo "=> PIO 1 detected") || \
     ($(FC) pio2.f90 -ffixed-line-length-132 $(FCINCLUDES) $(FFLAGS) $(LDFLAGS) $(LIBS) -o pio2.out &> /dev/null && echo "=> PIO 2 detected") || \
     (echo " ************ERROR************"; \
      echo "Failed to compile a PIO test program"; \
      echo "Please ensure the PIO environment variable is set to the PIO installation directory"; \
      echo " ************ERROR************"; \
     # rm -rf pio[12].f90 pio[12].out; exit 1)

```

The other option is to ignore the fallure by removing the pio\_test from the Makefile.

Replace

```auto
mpas_main: openmp_test mpio_test

```

with

```auto
mpas_main: openmp_test

```

---

<div class="post-metadata">

**Author:** ![penguin](https://avatars.discourse-cdn.com/v4/letter/p/e480ec/32.png) [@penguin](https://forum.cmascenter.org/u/penguin)\
**Post date:** [December 4, 2024, 3:27pm UTC](https://forum.cmascenter.org/t/encountering-errors-during-mpas-cmaq-compilation/5405/3 "2024-12-04T15:27:14Z")

</div>

Thank you very much for your patient answers! Since I used Intel and MVAPICH to compile various libraries, I modified the `ifort` section in the Makefile:  
Before modification:

 ![before](https://canada1.discourse-cdn.com/flex027/uploads/cmas/original/2X/4/469db678273b0ba940d85614dfc772ba5d333b8d.png)

After modification:

 ![after](https://canada1.discourse-cdn.com/flex027/uploads/cmas/original/2X/a/a0078500be288bc3eb21ecff8e9000b04138e980.png)

As a result, my compilation was able to run, but I encountered a new error at the end：IT\_version=unknown

 ![1](https://canada1.discourse-cdn.com/flex027/uploads/cmas/original/2X/7/76ecb006fbedfb83be9155d2f22f83d483c93d11.png)

Could you please help me? I have provided my environment and commands here, and I look forward to your response very much!  
[myworkflow.txt](https://forum.cmascenter.org/uploads/short-url/cxIHNxUDtwuv2ycX4VowDLqc8J2.txt) (1.1 KB)

In addition, I have two questions:

1. Is it necessary to run `./config_cmaq.csh` before copying CMAQ to the MPAS folder? Or can I just follow the operations in my attached files?
2. The MPAS-CMAQ usage guide mentions, “The version of CMAQ that can be coupled with MPAS uses a new I/O system called MIO. This I/O code is in the `CCTM/src/mio` directory and is compiled along with MPAS and CMAQ. There is no need to compile a separate I/O API library for this CMAQ configuration.” However, I did not find the `src` folder in the `CCTM` folder; there is only a `scripts` folder in `CCTM`. I am very confused.

---

<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:** [December 4, 2024, 4:54pm UTC](https://forum.cmascenter.org/t/encountering-errors-during-mpas-cmaq-compilation/5405/4 "2024-12-04T16:54:47Z")

</div>

Prior to running bldit\_cctm.csh in your myworkflow.txt please do the following:

Uncomment the `set build_mpas_cmaq` option to build MPAS-CMAQ

```auto
#> MPAS-CMAQ coupled model
set build_mpas_cmaq #> uncomment to build MPAS-CMAQ coupled model;

```

Then run:  
 ./bldit\_cctm.csh intel

You will then need to redo the remaining steps.

---

<div class="post-metadata">

**Author:** ![willison.jeff](https://avatars.discourse-cdn.com/v4/letter/w/c89c15/32.png) [@willison.jeff](https://forum.cmascenter.org/u/willison.jeff)\
**Post date:** [December 4, 2024, 10:58pm UTC](https://forum.cmascenter.org/t/encountering-errors-during-mpas-cmaq-compilation/5405/5 "2024-12-04T22:58:59Z")

</div>

There should be a Makefile (for CMAQ), MIO code, and CMAQ code in your build directory:

> /share/home/wjd/panting/MPASCMAQ/CMAQ\_5.5/CCTM/scripts/BLD\_CCTM\_v55\_intel\_cracmm2\_m3dry

I’m curious what the output of your bldit\_cctm.csh looks like. The source (src) directory is in the code repository (repo):

> CMAQ\_ **REPO** /CCTM/src

The project directory ($CMAQ\_ **HOME** /CCTM) doesn’t have a “src” directory. It pulls the source code from the repo into the build directory (BLD\_CCTM\_v55\_intel\_cracmm2\_m3dry). This BLD\_\*\* directory is then copied over to src/core\_atmosphere/cmaq

 ![Screenshot 2024-12-04 180821](https://canada1.discourse-cdn.com/flex027/uploads/cmas/original/2X/8/8e9099c311d8f4c4a10e4acbf5dc0e84c96d16e4.png)

---

<div class="post-metadata">

**Author:** ![penguin](https://avatars.discourse-cdn.com/v4/letter/p/e480ec/32.png) [@penguin](https://forum.cmascenter.org/u/penguin)\
**Post date:** [December 5, 2024, 3:44pm UTC](https://forum.cmascenter.org/t/encountering-errors-during-mpas-cmaq-compilation/5405/6 "2024-12-05T15:44:26Z")

</div>

@lizadams @willison.jeff  
Thank you both for your replies! I think there might have been some issues already when I was installing CMAQ. After cloning MPAS\_CMAQ,i set the "CMAQ\_HOME"in `bldit_project.csh` and then ran it. The interface looked like this:

 ![1251](https://canada1.discourse-cdn.com/flex027/uploads/cmas/original/2X/2/246b66c55dc8db1633e386d870b02b58b4c358c6.png)

Afterwards, I entered `CMAQ_V5.5/CCTM/scripts` ,uncommented the line “set build\_mpas\_cmaq” and directly ran `./bldit_cctm.csh intel`. But the interface looked like this,  
[error.txt](https://forum.cmascenter.org/uploads/short-url/Ux6lwYnGrVqn4GbIdqijN2ed3t.txt) (14.0 KB)

maybe I didn’t succeed in running this step at all. That would explain why my `BLD_CCTM_v55_intel_cracmm2_m3dry` folder only contains these items and the `Makefile` is an empty file.

 ![1252](https://canada1.discourse-cdn.com/flex027/uploads/cmas/original/2X/2/2c15af80831d2c036cbf400a06f6c5a452942825.png)  
 ![1253](https://canada1.discourse-cdn.com/flex027/uploads/cmas/original/2X/a/a597f2d81d536551493e63019df746e30e52e36c.png)

I would like to know if I’ve missed something somewhere? Here I’m attaching my `CMAQ_REPO/bldit_project.csh` and `CMAQ_V5.5/CCTM/scripts/bldit_cctm.csh` files. I’m looking forward to and sincerely appreciate your answers!  
[bldit\_project.csh](https://forum.cmascenter.org/uploads/short-url/3oXbVddzEN7BnofiCdYnMIk2J19.csh) (12.1 KB)  
[bldit\_cctm.csh](https://forum.cmascenter.org/uploads/short-url/xWE0aBZlzklY61J8Jefa5UtmDRU.csh) (38.0 KB)

---

<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:** [December 5, 2024, 4:08pm UTC](https://forum.cmascenter.org/t/encountering-errors-during-mpas-cmaq-compilation/5405/7 "2024-12-05T16:08:14Z")

</div>

I see a few errors in your error.txt. It seems to be related to your using mpiifort instead of mpifort.

```auto
setenv FC mpiifort

```

change to

```auto
setenv FC mpifort

```

You can verify the command that should be used by doing:

```auto
which mpifort

```

and

```auto
which mpiifort

```

To see which is correct.

This is the error message in your error.txt that is preventing progress.

```auto
mpiifort: Command not found.
mpiifort: Command not found.
mpiifort: Command not found.
mpiifort: Command not found.
mpiifort: No match.

 ***ERROR*** BLDMAKE Compile failed

```

Actually, the error may be in the config\_cmaq.csh

Check these settings and verify that you are using mpifort not mpiifort.

```auto
setenv myFC mpifort
setenv myCC icc

```

The config\_cmaq.csh on line 99 in the repo uses mpiifort, but this may not work for every system.

> <https://github.com/USEPA/CMAQ/blob/main/config_cmaq.csh#L99C21-L99C29>

---

<div class="post-metadata">

**Author:** ![penguin](https://avatars.discourse-cdn.com/v4/letter/p/e480ec/32.png) [@penguin](https://forum.cmascenter.org/u/penguin)\
**Post date:** [December 5, 2024, 5:04pm UTC](https://forum.cmascenter.org/t/encountering-errors-during-mpas-cmaq-compilation/5405/8 "2024-12-05T17:04:15Z")

</div>

Thank you for your reply! I tried to follow your instructions and successfully set `setenv myFC mpifort`, which allowed `bldit_cctm.csh` to run without issues. However, after copying the `BLD_*` files to MPAS, modifying the top-level `MPAS/Makefile` by replacing `mpas_main: openmp_test mpio_test` with `mpas_main: openmp_test`, and making the changes to the `ifort` section as I previously described, I encountered a new error when running `make Intel CORE=atmosphere USE_PIO2=true`.

 ![1254](https://canada1.discourse-cdn.com/flex027/uploads/cmas/original/2X/a/a49df2a13f8ca368e3ee438c145e46e3cf0c620f.png)  
BTW, before running, I had already executed `csh env.csh`, and this script contains the following content:

```auto
#!/bin/csh -f

module delete netcdf/4.3.0

module add netcdf/4.8.0
module add PnetCDF/1.9.0

setenv PIO /share/home/wjd/wb/lib/pio-2.6.2
setenv NETCDF /nuist/p/public/app/netcdf/4.8.0/intel/18.0.0
setenv PNETCDF /nuist/p/public/app/PnetCDF/1.9.0

setenv USE_PIO2 true

```

Why am I still encountering such an error then?  
I’m really sorry for encountering so many problems and disturbing you repeatedly.

---

<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:** [December 5, 2024, 5:51pm UTC](https://forum.cmascenter.org/t/encountering-errors-during-mpas-cmaq-compilation/5405/9 "2024-12-05T17:51:24Z")

</div>

Thank you for sharing your findings.  
I believe that this section of the Makefile needs to be edited depending on what version of the pio library is compiled.

I am including the settings that I used, notice where I commented out the requirement to find -lpio, as on my system, there is only a -lpiof and -lpioc

```auto
#
# Depending on PIO version, libraries may be libpio.a, or libpiof.a and libpioc.a
# Keep open the possibility of shared libraries in future with, e.g., .so suffix
#
ifneq ($(wildcard $(PIO_LIB)/libpio\.*), )
# LIBS += -lpio
endif
ifneq ($(wildcard $(PIO_LIB)/libpiof\.*), )
        LIBS += -lpiof
endif
ifneq ($(wildcard $(PIO_LIB)/libpioc\.*), )
        LIBS += -lpioc
endif
ifneq ($(wildcard $(PIO_LIB)/libgptl\.*), )
        LIBS += -lgptl
endif

```

The reason that this section fails is because there exists a file that meets the criteria but it is not the libpio.a library. My commenting out the -lpio is a workaround.

```auto
ls libpio\.*
libpio.settings

```

---

<div class="post-metadata">

**Author:** ![penguin](https://avatars.discourse-cdn.com/v4/letter/p/e480ec/32.png) [@penguin](https://forum.cmascenter.org/u/penguin)\
**Post date:** [January 3, 2025, 8:57am UTC](https://forum.cmascenter.org/t/encountering-errors-during-mpas-cmaq-compilation/5405/10 "2025-01-03T08:57:38Z")

</div>

Thank you for your previous assistance! I apologize for the delay in my response. I have made some changes to my workflow and modified the config\_cmaq.csh file, but the error remains the same.

 ![图片](https://canada1.discourse-cdn.com/flex027/uploads/cmas/original/2X/c/cd7d5f32673c397c2d9a4eb8a23a2151a2f50b6e.png)

I didn’t fully understand the issue you mentioned regarding PIO, so I didn’t make any changes to that part. I have uploaded my Makefile, environment and workflow details, and the log file from the make process. Could you please provide me with some additional help?

Thank you very much!  
[Makefile.txt](https://forum.cmascenter.org/uploads/short-url/7aLhRCxadupqw8mxtjffMZmavRB.txt) (27.2 KB)  
[mylog.txt](https://forum.cmascenter.org/uploads/short-url/tzoghTsLXpjuI9B3F7aPFlaqgro.txt) (4.2 KB)

 ![workflow_1](https://canada1.discourse-cdn.com/flex027/uploads/cmas/original/2X/b/baad88fb70495224e177e46476175ec542e3fe87.png)  
 ![workflow_2](https://canada1.discourse-cdn.com/flex027/uploads/cmas/original/2X/1/16ecdb2ad8aa293b9da8d2fd4e95293549fe3c15.png)  
 ![workflow_3](https://canada1.discourse-cdn.com/flex027/uploads/cmas/original/2X/4/4b9eef2106c8dddc6dec82f17373d99c6c36e370.png)  
 ![workflow_4](https://canada1.discourse-cdn.com/flex027/uploads/cmas/original/2X/2/2a80be895a6ae79d2cb3a159d7ed99f5c0826e53.png)
