# Failed to Build CRTM using ecbuild

**URL:** <https://forums.jcsda.org/t/failed-to-build-crtm-using-ecbuild/467>\
**Category:** CRTM\
**Created:** [April 26, 2023, 5:11am UTC](https://forums.jcsda.org/t/failed-to-build-crtm-using-ecbuild/467 "2023-04-26T05:11:00Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![cce\_space](https://avatars.discourse-cdn.com/v4/letter/c/f9ae1b/32.png) [@cce\_space](https://forums.jcsda.org/u/cce_space)\
**Post date:** [April 26, 2023, 5:11am UTC](https://forums.jcsda.org/t/failed-to-build-crtm-using-ecbuild/467/1 "2023-04-26T05:11:00Z")

</div>

I was trying to build CRTM from this [GitHub - JCSDA/crtm-bundle: Bundle containing all the repositories that are needed to compile CRTM v2.4.0.](https://github.com/JCSDA/crtm-bundle) in a Linux workstation 20.04. Upon trying what is suggested in the README file, i.e. sh ./kickstart\_pyCRTM.sh, I was shown this error.

– [crtm] (2.4.0) [8bf1007]  
– Found OpenMP\_Fortran: -fopenmp (found version “4.5”)  
– Found OpenMP: True (found version “4.5”) found components: Fortran  
CMake Error at /usr/share/cmake-3.16/Modules/FindPackgeHandleStandardArgs.cmake:146 (message):  
Could NOT find NetCDF (missing: NetCDF\_INCLUDE\_DIRS NetCDF\_LIBRARIES Fortran)  
Call Stack (most recent call first):  
/usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (\_FPHSA\_FAILURE\_MESSAGE)  
/usr/share/ecbuild/cmake/FindNetCDF.cmake:168 (find\_package\_handle\_standard\_args)  
crtm/CMakeLists.txt: 21 (find\_package)

I edited the shell script and added these flags in the ecbuild line:  
ecbuild -DNetCDF\_INCLUDE\_DIRS=/home/user/Documents/netcdf/ -DNetCDF\_LIBRARIES=/home/user/Documents/netcdf/lib/ …/

But now I was shown this error:

– [crtm] (2.4.0) [8bf1007]  
– Found OpenMP\_Fortran: -fopenmp (found version “4.5”)  
– Found OpenMP: True (found version “4.5”) found components: Fortran  
CMake Error at /usr/share/cmake-3.16/Modules/FindPackgeHandleStandardArgs.cmake:146 (message):  
Could NOT find NetCDF (missing: Fortran) (found version “4.7.2”)  
Call Stack (most recent call first):  
/usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (\_FPHSA\_FAILURE\_MESSAGE)  
/usr/share/ecbuild/cmake/FindNetCDF.cmake:168 (find\_package\_handle\_standard\_args)  
crtm/CMakeLists.txt: 21 (find\_package)

However, the gfortran installed in my system is 9.4.0 (the 4.7.2 seems to be the version for my NetCDF). So I don’t know what version _was_ found nor how to correct this error. I don’t even know if this is an error for CRTM or for CMake.

If there is any more information required, I can gladly provide them. Thank you!

---

<div class="post-metadata">

**Author:** ![StegmannJCSDA](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.jcsda.org/stegmannjcsda/32/53_2.png) [@StegmannJCSDA](https://forums.jcsda.org/u/StegmannJCSDA)\
**Post date:** [April 26, 2023, 5:07pm UTC](https://forums.jcsda.org/t/failed-to-build-crtm-using-ecbuild/467/2 "2023-04-26T17:07:51Z")

</div>

Hello @cce_space , welcome to the forum!

This looks like ecbuild not being able to find the Fortran API of NetCDF:

> [@cce\_space](#):
>
> Could NOT find NetCDF (missing: Fortran) (found version “4.7.2”)

This could have multiple reasons. Can you first check that the NetCDF Fortran API is available on your system and then that you are able to link it in an application?

---

<div class="post-metadata">

**Author:** ![chengdang](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.jcsda.org/chengdang/32/185_2.png) [@chengdang](https://forums.jcsda.org/u/chengdang)\
**Post date:** [April 26, 2023, 6:06pm UTC](https://forums.jcsda.org/t/failed-to-build-crtm-using-ecbuild/467/3 "2023-04-26T18:06:50Z")

</div>

@cce_space welcome!

> Could NOT find NetCDF (missing: Fortran) (found version “4.7.2”)

Follow up on this error and the comment above, could you please also share the file names in your netCDF library folder? i.e.: /home/user/Documents/netcdf/lib/

---

<div class="post-metadata">

**Author:** ![cce\_space](https://avatars.discourse-cdn.com/v4/letter/c/f9ae1b/32.png) [@cce\_space](https://forums.jcsda.org/u/cce_space)\
**Post date:** [April 27, 2023, 1:34am UTC](https://forums.jcsda.org/t/failed-to-build-crtm-using-ecbuild/467/4 "2023-04-27T01:34:25Z")

</div>

Thank you for the replies.

For checking the NetCDF Fortran API available on the system, I ran nf-config --all, and this showed.

```auto
This netCDF-Fortran 4.5.2 has been built with the following features: 

  --cc -> gcc
  --cflags -> -I/home/user/Documents/netcdf/include -I/home/user/Documents/include -I/home/user/Documents/netcdf/include -I/home/user/Documents/grib2/include

  --fc -> gfortran
  --fflags -> -I/home/user/Documents/netcdf/include
  --flibs -> -L/home/user/Documents/netcdf/lib -lnetcdff -L/home/user/Documents/lib -L/home/user/Documents/netcdf/lib -L/home/user/Documents/grib2/lib -lnetcdf -ldl -lm -lnetcdf -lhdf5_hl -lhdf5 -lz
  --has-f90 -> 
  --has-f03 -> yes

  --has-nc2 -> yes
  --has-nc4 -> yes

  --prefix -> /home/user/Documents/netcdf
  --includedir-> /home/user/Documents/netcdf/include
  --version -> netCDF-Fortran 4.5.2

```

For linking the NetCDF Fortran to an application, I just copied a sample NetCDF-Fortran code from here: [NetCDF | Programming in Modern Fortran](https://cyber.dabamos.de/programming/modernfortran/netcdf.html), and then compiled them using

```auto
gfortran -I/home/user/Documents/netcdf/include/ -L/home/user/Documents/netcdf/lib/ -o example example.f90 -lnetcdff

```

It gave the expected results.

```auto
Data to be written to NetCDF file:
----------------------------------------------------------------
   0 1 2 3 4 5 6 7 8 9 10 11
   6 7 8 9 10 11 12 13 14 15 16 17
  12 13 14 15 16 17 18 19 20 21 22 23
  18 19 20 21 22 23 24 25 26 27 28 29
  24 25 26 27 28 29 30 31 32 33 34 35
  30 31 32 33 34 35 36 37 38 39 40 41
----------------------------------------------------------------

Data read from NetCDF file:
----------------------------------------------------------------
   0 1 2 3 4 5 6 7 8 9 10 11
   6 7 8 9 10 11 12 13 14 15 16 17
  12 13 14 15 16 17 18 19 20 21 22 23
  18 19 20 21 22 23 24 25 26 27 28 29
  24 25 26 27 28 29 30 31 32 33 34 35
  30 31 32 33 34 35 36 37 38 39 40 41
----------------------------------------------------------------

```

Here are the contents of the /netcdf/lib/ folder,

```auto
libnetcdf.a libnetcdff.so libnetcdf.la libnetcdf.so.15
libnetcdff.a libnetcdff.so.7 libnetcdf.settings libnetcdf.so.15.2.0
libnetcdff.la libnetcdff.so.7.0.0 libnetcdf.so pkgconfig

```

And the contents of pkgconfig

```auto
netcdf-fortran.pc netcdf.pc

```

---

<div class="post-metadata">

**Author:** ![chengdang](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.jcsda.org/chengdang/32/185_2.png) [@chengdang](https://forums.jcsda.org/u/chengdang)\
**Post date:** [April 27, 2023, 3:32pm UTC](https://forums.jcsda.org/t/failed-to-build-crtm-using-ecbuild/467/5 "2023-04-27T15:32:20Z")

</div>

Thank you for the information.  
Could you please check which version of ecbuild are you using? Thanks.

---

<div class="post-metadata">

**Author:** ![cce\_space](https://avatars.discourse-cdn.com/v4/letter/c/f9ae1b/32.png) [@cce\_space](https://forums.jcsda.org/u/cce_space)\
**Post date:** [April 28, 2023, 1:37am UTC](https://forums.jcsda.org/t/failed-to-build-crtm-using-ecbuild/467/6 "2023-04-28T01:37:51Z")

</div>

The ecbuild is 3.1.0, while the cmake is 3.16.3.

---

<div class="post-metadata">

**Author:** ![StegmannJCSDA](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.jcsda.org/stegmannjcsda/32/53_2.png) [@StegmannJCSDA](https://forums.jcsda.org/u/StegmannJCSDA)\
**Post date:** [April 28, 2023, 5:50pm UTC](https://forums.jcsda.org/t/failed-to-build-crtm-using-ecbuild/467/7 "2023-04-28T17:50:02Z")

</div>

@cce_space can you try upgrading to:

```auto
ecbuild version 3.3.2
cmake version 3.26.3

```

Sometimes that fixes that sort of problem.

---

<div class="post-metadata">

**Author:** ![cce\_space](https://avatars.discourse-cdn.com/v4/letter/c/f9ae1b/32.png) [@cce\_space](https://forums.jcsda.org/u/cce_space)\
**Post date:** [May 2, 2023, 2:22am UTC](https://forums.jcsda.org/t/failed-to-build-crtm-using-ecbuild/467/8 "2023-05-02T02:22:35Z")

</div>

Good day, I apologise for the late reply, I was away on the weekend.

I upgraded my ecbuild to 3.3.2 and cmake to 3.26.3, unfortunately the problem still persists.

```auto
CMake Error at /snap/cmake/1288/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find NetCDF (missing: NetCDF_INCLUDE_DIRS NetCDF_LIBRARIES
  Fortran)
Call Stack (most recent call first):
  /snap/cmake/1288/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  /home/essmsd/Documents/ecbuild/share/ecbuild/cmake/FindNetCDF.cmake:168 (find_package_handle_standard_args)
  crtm/CMakeLists.txt:21 (find_package)

```

---

<div class="post-metadata">

**Author:** ![StegmannJCSDA](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.jcsda.org/stegmannjcsda/32/53_2.png) [@StegmannJCSDA](https://forums.jcsda.org/u/StegmannJCSDA)\
**Post date:** [May 4, 2023, 3:05pm UTC](https://forums.jcsda.org/t/failed-to-build-crtm-using-ecbuild/467/9 "2023-05-04T15:05:32Z")

</div>

Did you already try to build the crtm on its own (i.e. not the bundle)?
