# CCTM Compile Error

**URL:** <https://forum.cmascenter.org/t/cctm-compile-error/1260>\
**Category:** Compiling\
**Created:** [January 24, 2020, 11:36am UTC](https://forum.cmascenter.org/t/cctm-compile-error/1260 "2020-01-24T11:36:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yvsathe](https://avatars.discourse-cdn.com/v4/letter/y/c67d28/32.png) [@yvsathe](https://forum.cmascenter.org/u/yvsathe)\
**Post date:** [January 24, 2020, 11:36am UTC](https://forum.cmascenter.org/t/cctm-compile-error/1260/1 "2020-01-24T11:36:57Z")

</div>

I am getting following error while building CCTM:

wrtflag.F90:(.text+0x156): undefined reference to `GOMP_critical_name_end' /data/CMAQ/CMAQ_V5.3.1/lib/x86_64/gcc/ioapi/lib/libioapi.a(rdatt3.o): In function `master.0.rdatt3\_‘:  
rdatt3.F90:(.text+0x2c3): undefined reference to `GOMP_critical_name_start' rdatt3.F90:(.text+0x55b): undefined reference to `GOMP\_critical\_name\_end’  
rdatt3.F90:(.text+0xc89): undefined reference to `GOMP_critical_name_end' rdatt3.F90:(.text+0xd33): undefined reference to `GOMP\_critical\_name\_end’  
rdatt3.F90:(.text+0xdba): undefined reference to `GOMP_critical_name_end' rdatt3.F90:(.text+0x1780): undefined reference to `GOMP\_critical\_name\_end’  
/data/CMAQ/CMAQ\_V5.3.1/lib/x86\_64/gcc/ioapi/lib/libioapi.a(wratt3.o): In function `master.0.wratt3_': wratt3.F90:(.text+0x114): undefined reference to `GOMP\_critical\_name\_start’  
wratt3.F90:(.text+0x191): undefined reference to `GOMP_critical_name_end' wratt3.F90:(.text+0xa47): undefined reference to `GOMP\_critical\_name\_end’  
wratt3.F90:(.text+0xe0b): undefined reference to `GOMP\_critical\_name\_end’  
collect2: error: ld returned 1 exit status  
make: \*\*\* [CCTM\_v531.exe] Error 1  
**ERROR** while running make command

mv Makefile Makefile.gcc  
mv: ‘Makefile’ and ‘Makefile.gcc’ are the same file  
rm Makefile  
ln -s Makefile.gcc Makefile  
if ( 0 != 0 ) then  
if ( -e /data/CMAQ/CMAQ\_V5.3.1/CCTM/scripts/BLD\_CCTM\_v531\_gcc/CCTM\_v531.cfg ) then  
echo \>\>\> previous CCTM\_v531.cfg exists, re-naming to CCTM\_v531.cfg.old \<\<\<

> > > previous CCTM\_v531.cfg exists, re-naming to CCTM\_v531.cfg.old \<\<\<  
> > > mv /data/CMAQ/CMAQ\_V5.3.1/CCTM/scripts/BLD\_CCTM\_v531\_gcc/CCTM\_v531.cfg /data/CMAQ/CMAQ\_V5.3.1/CCTM/scripts/BLD\_CCTM\_v531\_gcc/CCTM\_v531.cfg.old  
> > > endif  
> > > mv CCTM\_v531.cfg.bld /data/CMAQ/CMAQ\_V5.3.1/CCTM/scripts/BLD\_CCTM\_v531\_gcc/CCTM\_v531.cfg  
> > > exit

I tried commenting ln -s Makefile.gcc Makefile and associated lines also. but still getting error.  
Executable is not built either.

---

<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:** [January 24, 2020, 2:13pm UTC](https://forum.cmascenter.org/t/cctm-compile-error/1260/2 "2020-01-24T14:13:25Z")

</div>

Hi Yogesh,

It looks like you are using the gcc compiler.  
Were you able to follow these installation instructions?

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

Basically, if the ioapi library was built to link with the openmp library, then you need to also link the openmp library to build the CMAQ executable.

The same compiler and flags used to build the ioapi library, must be used to build CMAQ.

wrtflag.F90 and the other f90 routines where you are getting the error are found in the ioapi library.  
Check the Makeinclude.\* file that you used to compile the ioapi library and see if you used the following option for the gcc compiler  
OMPFLAGS = -fopenmp  
OMPLIBS = -fopenmp

If you did, you need to either rebuild the ioapi library without linking the openmp library, or add that option to your config\_cmaq.csh under the section

case gcc

setenv myLINK\_FLAG “-fopenmp”

Liz

---

<div class="post-metadata">

**Author:** ![yvsathe](https://avatars.discourse-cdn.com/v4/letter/y/c67d28/32.png) [@yvsathe](https://forum.cmascenter.org/u/yvsathe)\
**Post date:** [January 27, 2020, 12:08pm UTC](https://forum.cmascenter.org/t/cctm-compile-error/1260/3 "2020-01-27T12:08:56Z")

</div>

Hi @lizadams  
Thank you for your inputs. Now I am able to compile CCTM and successfully create CCTM executable.

Please confirm if this settings in tutorial are correct:  
setenv CC /urs/local/apps/gcc/9.1.0/bin/gfortran  
setenv FC /urs/local/apps/gcc/9.1.0/bin/gcc  
setenv CXX /urs/local/apps/gcc/9.1.0/bin/g++

I used following to successfully compile netcdf-c and netcdf-fortran  
setenv FC /urs/local/apps/gcc/9.1.0/bin/gfortran  
setenv CC /urs/local/apps/gcc/9.1.0/bin/gcc  
setenv CXX /urs/local/apps/gcc/9.1.0/bin/g++

Please confirm.

---

<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:** [February 4, 2020, 9:57pm UTC](https://forum.cmascenter.org/t/cctm-compile-error/1260/4 "2020-02-04T21:57:06Z")

</div>

Hi Yogesh,

Thank you. I have corrected the instructions.  
Liz
