# CMAQ5.3 CCTM undefined reference error

**URL:** <https://forum.cmascenter.org/t/cmaq5-3-cctm-undefined-reference-error/997>\
**Category:** Compiling\
**Created:** [October 3, 2019, 3:00pm UTC](https://forum.cmascenter.org/t/cmaq5-3-cctm-undefined-reference-error/997 "2019-10-03T15:00:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jliu](https://avatars.discourse-cdn.com/v4/letter/j/8baadc/32.png) [@jliu](https://forum.cmascenter.org/u/jliu)\
**Post date:** [October 3, 2019, 3:00pm UTC](https://forum.cmascenter.org/t/cmaq5-3-cctm-undefined-reference-error/997/1 "2019-10-03T15:00:25Z")

</div>

Hello,  
Any one has any suggestions on the compiling errors below:  
Many thanks!

I used the gcc version 8.3.0; netcdf-c-4.6.0; netcdf-fortran-4.5.0; mpich-3.3.1; ioapi-3.2; no errors on icon, bcon ad micp

* * *

distr\_env.o: In function `distr\_env\_’:

distr\_env.c:(.text+0xc0): undefined reference to `ompi\_mpi\_comm\_world’

distr\_env.c:(.text+0xc7): undefined reference to `ompi\_mpi\_int’

distr\_env.c:(.text+0xe1): undefined reference to `ompi\_mpi\_char’

distr\_env.c:(.text+0xe7): undefined reference to `ompi\_mpi\_comm\_world’

distr\_env.c:(.text+0xf4): undefined reference to `ompi\_mpi\_comm\_world’

distr\_env.c:(.text+0x112): undefined reference to `ompi\_mpi\_comm\_world’

distr\_env.c:(.text+0x119): undefined reference to `ompi\_mpi\_int’

distr\_env.c:(.text+0x13b): undefined reference to `ompi\_mpi\_char’

distr\_env.c:(.text+0x141): undefined reference to `ompi\_mpi\_comm\_world’

collect2: error: ld returned 1 exit status

make: \*\*\* [CCTM\_v53.exe] Error 1

* * *

---

<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:** [October 3, 2019, 3:07pm UTC](https://forum.cmascenter.org/t/cmaq5-3-cctm-undefined-reference-error/997/2 "2019-10-03T15:07:14Z")

</div>

This looks like something in the build was done with _OpenMPI_ instead of _mpich_ – as a diagnostic, go to the directory for your MPI library and do `nm lib`. MPICH symbols have all-caps `MPI` in their prefixes; oOpenMPI ones have `ompi_`.

---

<div class="post-metadata">

**Author:** ![jliu](https://avatars.discourse-cdn.com/v4/letter/j/8baadc/32.png) [@jliu](https://forum.cmascenter.org/u/jliu)\
**Post date:** [October 3, 2019, 3:37pm UTC](https://forum.cmascenter.org/t/cmaq5-3-cctm-undefined-reference-error/997/3 "2019-10-03T15:37:12Z")

</div>

I did not find any “ompi\_” in MPI lib. “something in the build was done with \*OpenMPI”, which means that the CMAQ modules are builded by “openmpi” or others, such as ioapi? Any suggestion to fixed it? switch to openmpi?

---

<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:** [October 3, 2019, 3:51pm UTC](https://forum.cmascenter.org/t/cmaq5-3-cctm-undefined-reference-error/997/4 "2019-10-03T15:51:06Z")

</div>

It looks, in particular, as though _distr\_env.c_ was compiled with an OpenMPI _mpicc_, not with the corresponding MPICH _mpicc_. Try removing it (and maybe all the _.o_ files) and re-building.

---

<div class="post-metadata">

**Author:** ![rodrigo](https://avatars.discourse-cdn.com/v4/letter/r/4af34b/32.png) [@rodrigo](https://forum.cmascenter.org/u/rodrigo)\
**Post date:** [December 3, 2019, 12:14pm UTC](https://forum.cmascenter.org/t/cmaq5-3-cctm-undefined-reference-error/997/5 "2019-12-03T12:14:05Z")

</div>

I need help with the same problem, did anyone get a solution?

---

<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, 2019, 10:00pm UTC](https://forum.cmascenter.org/t/cmaq5-3-cctm-undefined-reference-error/997/6 "2019-12-04T22:00:32Z")

</div>

Please try following one of the tutorials that are available

> <https://github.com/USEPA/CMAQ/blob/master/DOCS/Users_Guide/Tutorials/CMAQ_UG_tutorial_build_library_gcc.md>
