# IODA not finding netcdf-cxx

**URL:** <https://forums.jcsda.org/t/ioda-not-finding-netcdf-cxx/709>\
**Category:** JEDI\
**Created:** [September 30, 2025, 9:44pm UTC](https://forums.jcsda.org/t/ioda-not-finding-netcdf-cxx/709 "2025-09-30T21:44:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmiesch1](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.jcsda.org/mmiesch1/32/217_2.png) [@mmiesch1](https://forums.jcsda.org/u/mmiesch1)\
**Post date:** [September 30, 2025, 9:44pm UTC](https://forums.jcsda.org/t/ioda-not-finding-netcdf-cxx/709/1 "2025-09-30T21:44:27Z")

</div>

Hi all - so I’m having a problem building ioda on my linux laptop. Cmake can’t find netcdf-cxx.

I have my own spack installation, based partly on the spack-stack version of spack.

When I link to netcdf for oops and saber everything is fine. But, when I get to ioda, it has problems finding the CXX component. In my stack the three component are installed as separate modules, in their own directories:

netcdf-c/4.9.2-iees7jj

netcdf-cxx/4.2-i4jkx37

netcdf-fortran/4.6.1-ordmma2

The error looks like this:

```auto
CMake Error at /home/miesch/jedi/spack-stack/spack/opt/spack/linux-ubuntu24.04-skylake/gcc-13.3.0/jedi-cmake-1.4.0-fw5jpjj66sdikkw2ne2dcjvaruqixf5y/share/jedicmake/Modules/FindNetCDF.cmake:246 (message):Unable to properly find NetCDF. Found static libraries at:/home/miesch/jedi/jedi-bundle/ioda/NetCDF_CXX_LIBRARY-NOTFOUND but couldnot run nc-config:

```

That suggests that it’s trying to get the netcdf-cxx informtion from nc-config? But nc-config runs fine with no indication of a cxx component. Is there some way to build netcdf-cxx so that it can be found by nc-config?

I tried setting NETCDF\_ROOT and NETCDF\_PATH as implied by the FindNetCDF file in jedi-cmake but it does not help. Also, I confirmed that the netcdf-cxx path is indeed included in CMAKE\_PREFIX\_PATH.

Any ideas? Thanks

---

<div class="post-metadata">

**Author:** ![stephenh](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.jcsda.org/stephenh/32/28_2.png) [@stephenh](https://forums.jcsda.org/u/stephenh)\
**Post date:** [September 30, 2025, 10:13pm UTC](https://forums.jcsda.org/t/ioda-not-finding-netcdf-cxx/709/2 "2025-09-30T22:13:25Z")

</div>

Hi Mark, good to hear from you. Hope things are going well. I think the issue might be that you need to set the following variables instead of NETCDF\_ROOT.

- netcdf\_ROOT
- netcdf\_cxx4\_ROOT (or perhaps in your case, netcdf\_cxx\_ROOT (no “4”))
- netcdf\_fortran\_ROOT

I’m guessing that NETCDF\_ROOT is for the case where you install all three packages (netcdf-c, netcdf-cxx, netcdf-fortran) in the same directory, and when these are in separate directories, then you need the three separate variables.

Note: the FindNetCDF macro should be running ncxx-config (or ncxx4-config) for netcdf-cxx, and nf-config for netcdf-fortran. Hopefully that will get straightened out when using the three separate environment variables.

---

<div class="post-metadata">

**Author:** ![stephenh](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.jcsda.org/stephenh/32/28_2.png) [@stephenh](https://forums.jcsda.org/u/stephenh)\
**Post date:** [September 30, 2025, 10:26pm UTC](https://forums.jcsda.org/t/ioda-not-finding-netcdf-cxx/709/3 "2025-09-30T22:26:45Z")

</div>

Sorry missed the comment about the CMAKE\_PREFIX\_PATH. It might be that you will need to use the “\_DIR” or “\_PATH” versions of the three variables to get CMake to look specifically if and where files like netcdf-c-config.cmake are installed.

---

<div class="post-metadata">

**Author:** ![mmiesch1](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.jcsda.org/mmiesch1/32/217_2.png) [@mmiesch1](https://forums.jcsda.org/u/mmiesch1)\
**Post date:** [September 30, 2025, 10:29pm UTC](https://forums.jcsda.org/t/ioda-not-finding-netcdf-cxx/709/4 "2025-09-30T22:29:10Z")

</div>

Thanks Steve - Good to hear from you!

Yes - after I entered that I took a closer look at the FindNetCDF.cmake file and it looks like it wants to use ncxx4\_config. But my netcdf-cxx-4.2 module has no bin directory so that program does not exist. I’ll probably need to re-install it with different spack options. I’ll do more digging. But can you confirm what version of netcdf-cxx you use these days?

---

<div class="post-metadata">

**Author:** ![stephenh](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.jcsda.org/stephenh/32/28_2.png) [@stephenh](https://forums.jcsda.org/u/stephenh)\
**Post date:** [September 30, 2025, 10:39pm UTC](https://forums.jcsda.org/t/ioda-not-finding-netcdf-cxx/709/5 "2025-09-30T22:39:48Z")

</div>

We are using:

- netcdf-c 4.9.2
- netcdf-cxx4 4.3.1
- netcdf-fortran 4.6.1

It might be helpful to look at the JCSDA spack package spec to get an idea of the netcdf-cxx build options. [spack/var/spack/repos/builtin/packages/netcdf-cxx4/package.py at spack-stack-dev · JCSDA/spack · GitHub](https://github.com/JCSDA/spack/blob/spack-stack-dev/var/spack/repos/builtin/packages/netcdf-cxx4/package.py)

Good luck with this! And let me know if you have more questions/issues.

---

<div class="post-metadata">

**Author:** ![mmiesch1](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.jcsda.org/mmiesch1/32/217_2.png) [@mmiesch1](https://forums.jcsda.org/u/mmiesch1)\
**Post date:** [September 30, 2025, 10:45pm UTC](https://forums.jcsda.org/t/ioda-not-finding-netcdf-cxx/709/6 "2025-09-30T22:45:57Z")

</div>

Problem solved.

The problem was that I installed the netcdf-cxx spack module instead of the netcdf-cxx4 module. When I install the latter, the config file is there and it compiles. Thanks again!

---

<div class="post-metadata">

**Author:** ![stephenh](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.jcsda.org/stephenh/32/28_2.png) [@stephenh](https://forums.jcsda.org/u/stephenh)\
**Post date:** [September 30, 2025, 10:51pm UTC](https://forums.jcsda.org/t/ioda-not-finding-netcdf-cxx/709/7 "2025-09-30T22:51:39Z")

</div>

You are welcome, and great to hear it is working!
