'How to install netcdf-cxx using yum?

When I used Yum to install NetCDF cxx, I encountered some problems. First, I use the following code to install:

>>> yum install -y netcdf-cxx netcdf-cxx-devel netcdf netcdf-devel

Then, I checked the installation results and found that libnetcdf_c++.so exists in the /usr/lib64 directory. So,it can be said that the installation was successful.

>>> locate libnet
/usr/lib64/.libnettle.so.4.7.hmac
/usr/lib64/.libnettle.so.4.hmac
/usr/lib64/libnetcdf.settings
/usr/lib64/libnetcdf.so
/usr/lib64/libnetcdf.so.7
/usr/lib64/libnetcdf.so.7.2.0
/usr/lib64/libnetcdf_c++.so
/usr/lib64/libnetcdf_c++.so.4
/usr/lib64/libnetcdf_c++.so.4.2.0
/usr/lib64/libnetcdff.so
/usr/lib64/libnetcdff.so.5
/usr/lib64/libnetcdff.so.5.3.1
/usr/lib64/libnettle.so.4
/usr/lib64/libnettle.so.4.7
/usr/share/perl5/Net/libnet.cfg
/usr/share/perl5/Net/libnetFAQ.pod

However, when I execute nc-config --all, the result is that NetCDF-cxx is not installed.


This netCDF 4.3.3.1 has been built with the following features: 

  --cc        -> gcc
  --cflags    ->  -I/usr/include -I/usr/include/hdf
  --libs      -> 

  --has-c++   -> no
  --cxx       -> 
  --has-c++4  -> no
  --cxx4      -> 

  --fc        -> gfortran
  --fflags    -> -I/usr/include
  --flibs     -> -lnetcdff  
  --has-f90   -> yes

  --has-dap   -> yes
  --has-nc2   -> yes
  --has-nc4   -> yes
  --has-hdf5  -> yes
  --has-hdf4  -> yes
  --has-pnetcdf-> no

  --prefix    -> /usr
  --includedir-> /usr/include
  --version   -> netCDF 4.3.3.1

What should I do to install netcdf-cxx correctly using Yum?



Solution 1:[1]

You are using a ~10 year old version of netCDF. As you note, it appears the C++ libraries are there, so the issue might simply be that the nc-config program is at fault and netCDF C++ is fine. To test this, just use the C-library flags when you build a C++ program and things might work fine. Otherwise, upgrade to a newer OS and netCDF version :)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Charlie Zender