Installing NetCDF

I would like to write a fortran program which uses NetCDF. In order to do so, I have to have the netcdf-module somewhere on my harddisc, and tell my compiler where to find it. In Synaptic, the following packages are installed:

netcdf-bin
nco
netcdf-doc
libnetcdf-dev
libnetcdf6

libnetcdf-dev, especially, promises "everything needed for developing in C, C++, Fortran 77, and Fortran 90"; however, I cannot find the libraries anywhere on my system, and accordingly, I cannot develop anything. Where might the libraries be? They are neither in /usr/share, nor in /usr/lib. And how, in general, can I found out where a package installs its files on my machine?

2 Answers

If you open Synaptic and focus on any installed package then click "Properties" button, you can see dialog with "Installed Files" tab.

So netcdf libraries are in /usr/lib/ and include files in /usr/include if you installed libnetcdf-dev through packaging system

0

In addition to using system tools, nc-config and nf-config can help you find those details. This may be helpful if netcdf was compiled by you or someone else in your organization.

I believe nf-config only started shipping sometime after netcdf 4.2 was released, because the fortran lib was split into a different package then. So, if you fail to find the relevant fortran information with nc-config, check if nf-config exists somewhere and use it instead.

From netcdf 4.2 release notes:

Beginning with version 4.2, the three [c, c++, fortran] libraries are being released as separate packages.

Finally, here's a sample output of nc-config --all:

This netCDF 4.2.1.1 has been built with the following features: --cc -> gcc --cflags -> -I/usr/local/include -I/share/ed/local/spike/include --libs -> -L/usr/local/lib -lnetcdf --has-c++ -> no --cxx -> --has-c++4 -> yes --cxx4 -> g++ --fc -> gfortran --fflags -> -g -O2 -I/usr/local/include --flibs -> -L/usr/local/lib -lnetcdff -lnetcdf -lnetcdf --has-f90 -> yes --has-dap -> yes --has-nc2 -> yes --has-nc4 -> yes --has-hdf5 -> yes --has-hdf4 -> no --has-pnetcdf-> no --has-szlib -> --prefix -> /usr/local --includedir-> /usr/local/include --version -> netCDF 4.2.1.1

The left column has the options that can be sent to nc-config instead of --all to produce more specific output.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like