# Megan 2,1 install error, cannot find -lioapi

**URL:** <https://forum.cmascenter.org/t/megan-2-1-install-error-cannot-find-lioapi/5203>\
**Category:** MEGAN\
**Created:** [September 10, 2024, 11:53pm UTC](https://forum.cmascenter.org/t/megan-2-1-install-error-cannot-find-lioapi/5203 "2024-09-10T23:53:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![nenghan](https://avatars.discourse-cdn.com/v4/letter/n/bc79bd/32.png) [@nenghan](https://forum.cmascenter.org/u/nenghan)\
**Post date:** [September 10, 2024, 11:53pm UTC](https://forum.cmascenter.org/t/megan-2-1-install-error-cannot-find-lioapi/5203/1 "2024-09-10T23:53:15Z")

</div>

I’m trying to install Megan v2.1 and met this error when I used ‘./make\_all\_programs.scr 64bit’

 ![image](https://canada1.discourse-cdn.com/flex027/uploads/cmas/original/2X/e/edf129cddf24bcfc6c0b55ae625db7ecb9916ba9.png)  
it said cannot find -lioapi, also 'underfiend reference to ‘ncaaptc’, I install netcdf using gfortran, but use pgf90 to install Megan. The ioapi package is installed successfully with pgf90. attached is full outpout of the command  
[output.txt](https://forum.cmascenter.org/uploads/short-url/3H3rzSxArojRn4hU9kOsiwy0obw.txt) (36.7 KB)

Thank you for your help in advance.

---

<div class="post-metadata">

**Author:** ![nenghan](https://avatars.discourse-cdn.com/v4/letter/n/bc79bd/32.png) [@nenghan](https://forum.cmascenter.org/u/nenghan)\
**Post date:** [September 11, 2024, 2:23am UTC](https://forum.cmascenter.org/t/megan-2-1-install-error-cannot-find-lioapi/5203/2 "2024-09-11T02:23:20Z")

</div>

I figure out the error ‘cannot find -lioapi’, it’s because of my ioapi package isn’t install correctly and the system can’t find it, I re-install and solve it. But still have errors like 'undefined reference to ‘ncvdef\_’, ‘ncaptc\_’. I guess it’s some related to netcdf package. I created symbolic links of libnetcdff.a and libnetcdf.a when I install ioapi package. Is it possible that it is because I installed netcdf (gcc) and ioapi package (pgf90) with a different compiler? Thank you in advance for any suggestions.

---

<div class="post-metadata">

**Author:** ![nenghan](https://avatars.discourse-cdn.com/v4/letter/n/bc79bd/32.png) [@nenghan](https://forum.cmascenter.org/u/nenghan)\
**Post date:** [September 11, 2024, 2:41am UTC](https://forum.cmascenter.org/t/megan-2-1-install-error-cannot-find-lioapi/5203/3 "2024-09-11T02:41:52Z")

</div>

lol, it’s actually a simple problem , I don’t add “-lnetcdff” to link flags from MEGAN, after add ‘-lnetcdff -lnetcdf’ in LIBS, I success install Megan

---

<div class="post-metadata">

**Author:** ![weeeb](https://avatars.discourse-cdn.com/v4/letter/w/97f17d/32.png) [@weeeb](https://forum.cmascenter.org/u/weeeb)\
**Post date:** [September 11, 2024, 6:54am UTC](https://forum.cmascenter.org/t/megan-2-1-install-error-cannot-find-lioapi/5203/4 "2024-09-11T06:54:04Z")

</div>

Dear nenghan

I’m sorry that I can’t help you in this problem, because I didn’t successfully run the MEGAN model. Maybe it’s a feasible solution to look for some help from the develop team of MEGAN.

Hope your problem would be addressed soon.

---

<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:** [September 11, 2024, 11:49am UTC](https://forum.cmascenter.org/t/megan-2-1-install-error-cannot-find-lioapi/5203/5 "2024-09-11T11:49:25Z")

</div>

What I/O API and netCDF versions? I think you are using an obsolete version of the first, and a newer version of the last.

See [https://cjcoats.github.io/ioapi/AVAIL.html#ncf4](https://cjcoats.github.io/ioapi/AVAIL.html#ncf4):

> Evidently, starting with netCDF-Fortran 4.4.2, UCAR in their wisdom decided to silently eliminate the CALL NC\*() Fortran interfaces in terms of which the I/O API was originally implemented. [If you can find any documentation indicating this intent on the web, I would enjoy seeing it; I can’t find it.]  
> I/O API Version 3.2 was tediously re-coded to replace all 943 of these calls by the newer IERR=NF\_\*() Fortran interfaces that are still supported. Prior editions of the I/O API will have link errors with netCDF-Fortran 4.4.2 or later, because routines such as NCCLOS() are no longer in that library.

That _undefined reference to ‘ncvdef\__ sounds exactly like that problem. Upgrade to the current I/O API 3.2 (and make sure you use `-lnetcdff -lnetcdf`).

---

<div class="post-metadata">

**Author:** ![nenghan](https://avatars.discourse-cdn.com/v4/letter/n/bc79bd/32.png) [@nenghan](https://forum.cmascenter.org/u/nenghan)\
**Post date:** [September 11, 2024, 1:54pm UTC](https://forum.cmascenter.org/t/megan-2-1-install-error-cannot-find-lioapi/5203/6 "2024-09-11T13:54:37Z")

</div>

Thank you for this notice, I use I/O API 3.1, netcdf-c-4.7.2 and netcdf- fortran-4.5.2, but I don’t find error when I install Megan using the I/O API 3.1.
