lalvarez wrote:Hello Mark
Yes I´m using the netcdf-4.2.1.1 version and the netcdf-fortran-4.2version.
Anyway I guess my mistake is in here, I configured netcdf-4.2.1.1 with this:
./configure --prefix=/usr/local --disable-shared --enable-netcdf-4 --enable-dap --disable-dap-remote-tests
and configured netcdf-fortran-4.2 with:
CC=gcc FC=gfortran LIBS="$(nc-config --libs)" CPPFLAGS="-I$(nc-config --includedir)" nice ./configure --disable-shared --prefix=/usr/local
instead of this sintax:
CC=gcc FC=gfortran LIBS="$(nf-config --libs)" CPPFLAGS="-I$(nf-config --includedir)" nice ./configure --disable-shared --prefix=/usr/local
As Kate once suggested in thread 2766
I´m going to try this last sintax and see what happen
Thanks in advance
No!!
Your configure command for building netcdf-fortran was fine. As far as I can tell, you have built & installed it with no problems. Your problem is that the information about the netcdf-fortran configuration is not being passed properly to ROMS.
Re nc-config & nf-config, nc-config is created when netcdf is built and it is installed in ${prefix}/bin (where prefix in your case is /usr/local). It is available to any application that wants to call the netcdf C library. Then you build netcdf-fortran: the cleanest way to tell the configure command where to find everything is with nc-config, hence the form of the configure command that I recommended. The netcdf-fortran build process creates its own counterpart to nc-config, called nf-config, and likewise installs it in ${prefix}/bin. That's
not the command you want when building netcdf-fortran, because the first time you build netcdf-fortran it doesn't exist.
The ROMS build process needs to know how to link to netcdf-fortran and for that the most elegant way is to call the appropriate configuration command, which in your case is nf-config (but see below). This is what should happen if you define USE_NETCDF4 (which can be done just by creating an environment variable in build.bash). Then the following line in the platform-specific make file comes into play
That tells ROMS that the netCDF configuration command is nc-config but allows it to be overridden by the environment. You want nf-config (but see below) so in your build.bash you need to set
But perhaps /usr/local/bin is not on your PATH (which might well be the problem in your case). In that case you could set this
Code: Select all
export NC_CONFIG=/usr/local/bin/nf-config
or you could ensure it is on your path (near the front, I suggest):
This could be in build.bash but is better in one of your startup files, I think.
IMHO ensuring the nf-config command you want is on your path is the best solution.
I hope that's clear enough; now I'm going to confuse things again. Why is the ROMS default nc-config, when nf-config is the right command? Because until recently (version 4.2.x) the netCDF C and Fortran libraries were not separate and there was no nf-config. But here's the clever and rather confusing thing: in the very latest version of netcdf-fortran, the nf-config script is still created & installed as I've described, but the pre-existing nc-config is also modified so that it knows where to find the Fortran stuff. (I've included output from nc-config and nf-config on my system at the bottom of this post to demonstrate.) Clever, though a bit dodgy in my opinion. So which to use? I would suggest nf-config if you have it and nc-config if you don't.
Code: Select all
$ nf-config --all
This netCDF-Fortran 4.2 has been built with the following features:
--cc -> gcc
--cflags -> -I/usr/local/include -I/usr/local/include
--libs -> -L/usr/local/lib -lnetcdf -L/usr/local/lib -lnetcdf -lhdf5_hl -lhdf5 -lm -lz -lcurl
--fc -> gfortran
--fflags -> -g -O2 -I/usr/local/include
--flibs -> -L/usr/local/lib -lnetcdff -lnetcdf -L/usr/local/lib -lnetcdf -lhdf5_hl -lhdf5 -lm -lz -lcurl
--has-f90 -> yes
--has-nc2 -> yes
--has-nc4 -> yes
--prefix -> /usr/local
--includedir-> /usr/local/include
--version -> netCDF-Fortran 4.2
$ nc-config --all
This netCDF 4.2.1.1 has been built with the following features:
--cc -> gcc
--cflags -> -I/usr/local/include
--libs -> -L/usr/local/lib -lnetcdf -lhdf5_hl -lhdf5 -lm -lz -lcurl
--has-c++ -> no
--cxx ->
--has-c++4 -> no
--cxx4 ->
--fc -> gfortran
--fflags -> -g -O2 -I/usr/local/include
--flibs -> -L/usr/local/lib -lnetcdff -lnetcdf -L/usr/local/lib -lnetcdf -lhdf5_hl -lhdf5 -lm -lz -lcurl
--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