# Compiling MEGAN3.2 with \[ioapi2uam\] error

**URL:** <https://forum.cmascenter.org/t/compiling-megan3-2-with-ioapi2uam-error/5093>\
**Category:** MEGAN\
**Created:** [July 23, 2024, 8:43am UTC](https://forum.cmascenter.org/t/compiling-megan3-2-with-ioapi2uam-error/5093 "2024-07-23T08:43:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lucysun](https://avatars.discourse-cdn.com/v4/letter/l/5f8ce5/32.png) [@lucysun](https://forum.cmascenter.org/u/lucysun)\
**Post date:** [July 23, 2024, 8:43am UTC](https://forum.cmascenter.org/t/compiling-megan3-2-with-ioapi2uam-error/5093/1 "2024-07-23T08:43:11Z")

</div>

Hi, everybody.  
I’m compiling MEGAN3.2 with intel2022. when I make MEGANv3.2\_Dec\_2021 for . **/make\_all\_programs.scr 64bit** step, the following error occurs:

ifort -O3 -fixed -132 -traceback -qopenmp -xHost -Bstatic -I/home/tools/ioapi32/ioapi/fixed\_src -I/home/tools/netcdf4/include -I/home/MEGAN/MEGANv3.2\_Dec\_2021/src/MGN2MECH/INCLDIR -o mgn2mech checkmem.o mgn2mech.o -L/home/tools/ioapi32/Linux2\_x86\_64ifort -lioapi -L/home/tools/netcdf4/lib -lnetcdff -lnetcdf  
pgf90 -O -Mvect=sse -Mextend -Msecond\_underscore -Bstatic\_pgi -Mlfs -I/home/tools/ioapi32/ioapi/fixed\_src -I/home/tools/netcdf4/include -c -o ioapi2uam.o ioapi2uam.f  
make: pgf90：Command not found  
make: \*\*\* [ioapi2uam.o] Error 127  
Create symbolic links

At this point, my makefile file reads:  
SHELL = /bin/sh  
**FC = pgf90**  
FFLAGS= -O -Mvect=sse -Mextend -Msecond\_underscore -Bstatic\_pgi -Mlfs  
#FC = ifort  
#FFLAGS = -O2 -fp-model precise -fpp -132 -mcmodel=large -convert big\_endian  
PROGRAM = ioapi2uam  
LIBS = -L/home/tools/ioapi32/Linux2\_x86\_64ifort -lioapi   
-L/home//tools/netcdf4/lib -lnetcdff -lnetcdf  
INCLUDE = -I/home/tools/ioapi32/ioapi/fixed\_src   
-I/home/tools/netcdf4/include

RAW = (PROGRAM).o .f.o: (FC) (FFLAGS) (INCLUDE) -c -o @ \<  
.F.o:  
(FC) (FFLAGS) (INCLUDE) -c -o @ \< (PROGRAM): (RAW) (FC) (FFLAGS) (INCLUDE) -o (@) (RAW) (LIBS) clean: rm -f (PROGRAM)

When I changed FC=pgf90 in it to **FC=ifort** , I had a lot of problems with undefined references.

/home/hanlu\_sun/CMAQ\_models/tools/ioapi32/Linux2\_x86\_64ifort/libioapi.a(rdatt3.o)：In function ‘rdatt3\_’:  
rdatt3.F90:(.text+0x4d6)：‘\_\_kmpc\_global\_thread\_num’ Undefined references  
rdatt3.F90:(.text+0xa75)：‘\__kmpc\_end\_critical’ Undefined references  
/home/hanlu\_sun/CMAQ\_models/tools/ioapi32/Linux2\_x86\_64ifort/libioapi.a(wratt3.o)：In function ‘wrattc_’：  
wratt3.F90:(.text+0x46)：‘\_\_kmpc\_global\_thread\_num’ Undefined references  
wratt3.F90:(.text+0x3d5)：‘\_\_kmpc\_critical’ Undefined references  
wratt3.F90:(.text+0x917)：‘\_\_kmpc\_end\_critical’ Undefined references  
wratt3.F90:(.text+0x94a)：‘\__kmpc\_end\_critical’ Undefined references  
/home/hanlu\_sun/CMAQ\_models/tools/ioapi32/Linux2\_x86\_64ifort/libioapi.a(wratt3.o)：In function ‘wratt3_’：  
wratt3.F90:(.text+0xaec)：‘\_\_kmpc\_global\_thread\_num’ Undefined references  
make: \*\*\* [ioapi2uam] error 1  
Create symbolic links

Looking forward to any replies you may have, thank you very much!

---

<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:** [July 23, 2024, 11:22am UTC](https://forum.cmascenter.org/t/compiling-megan3-2-with-ioapi2uam-error/5093/2 "2024-07-23T11:22:30Z")

</div>

Variants of this have shown up multiple times here.

You need to add -`qopenmp` to the compile and link flags if your ifort version is at least 15, or `-openmp` for earlier versions.

---

<div class="post-metadata">

**Author:** ![lucysun](https://avatars.discourse-cdn.com/v4/letter/l/5f8ce5/32.png) [@lucysun](https://forum.cmascenter.org/u/lucysun)\
**Post date:** [July 24, 2024, 12:54am UTC](https://forum.cmascenter.org/t/compiling-megan3-2-with-ioapi2uam-error/5093/3 "2024-07-24T00:54:07Z")

</div>

Hi, thank you very much for your reply.  
First of all my ifort version is 2021.6.0 and I compiled ioapi3.2 with -qopenmp added to the Makeinclude.Linux2\_x86\_64 ifort file as shown.  
The above error is still generated in this case. I’m not quite sure exactly how I should proceed and look forward to your guidance and response.

 ![ioapi](https://canada1.discourse-cdn.com/flex027/uploads/cmas/original/2X/b/bf2d5bbae70f07c719c62c35a57876dbd4958083.jpeg)

---

<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:** [July 24, 2024, 11:26am UTC](https://forum.cmascenter.org/t/compiling-megan3-2-with-ioapi2uam-error/5093/4 "2024-07-24T11:26:52Z")

</div>

You need to add -qopenmp to the **compile and link flags of everything** – including MEGAN.

---

<div class="post-metadata">

**Author:** ![lucysun](https://avatars.discourse-cdn.com/v4/letter/l/5f8ce5/32.png) [@lucysun](https://forum.cmascenter.org/u/lucysun)\
**Post date:** [July 25, 2024, 12:38am UTC](https://forum.cmascenter.org/t/compiling-megan3-2-with-ioapi2uam-error/5093/5 "2024-07-25T00:38:47Z")

</div>

Thanks for your reply, based on your answer I have managed to solve the problem.
