ROMS build problem due to faulty nf-config on CentOS Linux

Discussion on computers, ROMS installation and compiling

Moderators: arango, robertson

Post Reply
User avatar
Posts: 520
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

ROMS build problem due to faulty nf-config on CentOS Linux

#1 Post by m.hadfield » Mon Dec 12, 2016 3:16 am

I have a problem which I think is ultimately due to a broken netCDF binary package on CentOS Linux, but before taking it up with the package maintainers I want to raise it on the ROMS forum. I've also raised it on the netCDF group... ... 00324.html

...with no response to far.

I am, for the first time, running ROMS on my Windows desktop machine via Linux in a virtual machine, rather than via Cygwin. I have CentOS 7.1 and I am trying as far as possible to use the standard binary packages rather than building from source. (I plan to use this virtual machine for other purposes, including setting up pyroms.)

I use the usual method of building ROMS with USE_NETCDF4=on and NC_CONFIG=/usr/bin/nf-config, but it can't find the module files. Here are the netCDF details according to nf-config:

Code: Select all

$ /usr/bin/nf-config --all
This netCDF-Fortran 4.2 has been built with the following features: 

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

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

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

  --prefix    -> /usr
  --includedir-> /usr/include
  --version   -> netCDF-Fortran 4.2
Based on this, ROMS looks for netcdf.mod and typesizes.mod in /usr/include. However, they're not there, they're in /usr/lib64/gfortran/modules. By the way, the include file for the netCDF Fortran-77 interface, namely, is in /usr/include.

Now, I can see that there may be valid reasons for moving the netCDF .mod files to a new location. For one thing, files of this type are generally compiler-dependent, so arguably they do no belong in the system include directory. But by failing to tell anyone of this changed location via nf-config, the package maintainers have made things difficult for the users.

So, what to do?

I can't put a link to the .mod files in /usr/include, as I don't have administrator rights on the virtual machine (except that I can install packages via yum).

I tried setting environment variables as follows before running make

Code: Select all

export USE_NETCDF=
export NETCDF_INCDIR=/usr/lib64/gfortran/modules
export NETCDF_LIBDIR=/usr/lib64
but this still leaves the problem that the link command requires "-lnetcdff" rather than "-lnetcdf". This can be worked around with modifications to, but it's getting a bit messy.

So I think what I shall do is make my own, modifed nf-config script to spit out the values I want.

Finally, I've just noticed that the system netCDF package (installed last week) is at version 4.2, which is several years old. So perhaps I should just bite the bullet and build my own copy from source.

Anyway, there are various ways to work around this, but I'm curious whether anyone else has run into this problem (I couldn't find anything on the forum) and whether people think there is a case for raising this as an issue with the package maintainers.

Post Reply