Compiling & Building netcdf

Hello,

I am trying to compile and build Unidata netcdf-c & netcdf-fortrand libraries using PGI compilers. The source code for these libraries are available at:

The first library (netcdf-c) compiles & build quite well using the following configure options:

./configure --prefix=/usr/local/netcdf/c \
CC=pgcc \
LDFLAGS=-L/usr/local/hdf5/lib \
CPPFLAGS="-I/usr/local/hdf5/include -fpic"

But when i try to compile the netCDF-fortran 4.4.2 libraries, using the following configuration options:

./configure --prefix=/usr/local/netcdf/fortran \
--disable-shared \
CC=pgcc \
CPPFLAGS="-I/usr/local/hdf5/include -fpic" \
FC=pgfortran \
F77=pgfortran \
LDFLAGS=-L/usr/local/hdf5/lib

The following is being prompted:


pgfortran -DHAVE_CONFIG_H -I. -I.. -I../libsrc   -I/usr/local/hdf5/include -fpic -I../fortran   -I../fortran -g -c -o test_write.o test_write.F
pgfortran -DHAVE_CONFIG_H -I. -I.. -I../libsrc   -I/usr/local/hdf5/include -fpic -I../fortran   -I../fortran -g -c -o util.o util.F
source='f03lib.c' object='f03lib.o' libtool=no \
DEPDIR=.deps depmode=pgcc /b in/sh ../depcomp \
pgcc -DHAVE_CONFIG_H -I. -I.. -I../libsrc   -I/usr/local/hdf5/include -fpic  -g -DLONGLONG_IS_LONG -c -o f03lib.o f03lib.c
/bin/sh ../libtool  --tag=F77   --mode=link pgfortran -I../fortran   -I../fortran -g  -L/usr/local/hdf5/lib -o nf_test f03lib_f_interfaces.o test_get.o test_put.o nf_error.o nf_test.o test_read.o test_write.o util.o f03lib.o ../fortran/libnetcdff.la -lnetcdf 
libtool: link: pgfortran -I../fortran -I../fortran -g -o nf_test f03lib_f_interfaces.o test_get.o test_put.o nf_error.o nf_test.o test_read.o test_write.o util.o f03lib.o  -L/usr/local/hdf5/lib ../fortran/.libs/libnetcdff.a /usr/local/lib/libnetcdf.a
../fortran/.libs/libnetcdff.a(nf_control.o): In function `nf_inq_path_':
/tmp/netcdf-fortran-4.4.2/fortran/./nf_control.F90:307: undefined reference to `nc_inq_path'
Makefile:1251: recipe for target 'nf_test' failed
make[2]: *** [nf_test] Error 2
make[2]: Leaving directory '/tmp/netcdf-fortran-4.4.2/nf_test'
Makefile:1825: recipe for target 'check-am' failed
make[1]: *** [check-am] Error 2
make[1]: Leaving directory '/tmp/netcdf-fortran-4.4.2/nf_test'
Makefile:544: recipe for target 'check-recursive' failed
make: *** [check-recursive] Error 1

Also please notice a warning message prompted by libtool:

/bin/sh ../libtool  --tag=FC   --mode=link pgfortran  -g  -version-number 6:0:1 -L/usr/local/hdf5/lib -L/tmp/netcdf-fortran-4.4.2/fortran/.libs/ -o libnetcdff.la -rpath /usr/local/netcdf/fortran/lib typeSizes.lo module_netcdf_nc_data.lo module_netcdf_nc_interfaces.lo module_netcdf_nf_data.lo module_netcdf_nf_interfaces.lo module_netcdf_f03.lo nf_attio.lo nf_control.lo nf_dim.lo nf_misc.lo nf_genatt.lo nf_geninq.lo nf_genvar.lo nf_vario.lo nf_var1io.lo nf_varaio.lo nf_varmio.lo nf_varsio.lo    netcdf.lo netcdf3_file.lo nf_v2compat.lo module_netcdf_fortv2_c_interfaces.lo nf_fortv2.lo  -lnetcdf 
libtool: link: ar cru .libs/libnetcdff.a  typeSizes.o module_netcdf_nc_data.o module_netcdf_nc_interfaces.o module_netcdf_nf_data.o module_netcdf_nf_interfaces.o module_netcdf_f03.o nf_attio.o nf_control.o nf_dim.o nf_misc.o nf_genatt.o nf_geninq.o nf_genvar.o nf_vario.o nf_var1io.o nf_varaio.o nf_varmio.o nf_varsio.o netcdf.o netcdf3_file.o nf_v2compat.o module_netcdf_fortv2_c_interfaces.o nf_fortv2.o
ar: `u' modifier ignored since `D' is the default (see `U')
libtool: link: ranlib .libs/libnetcdff.a
libtool: link: ( cd ".libs" && rm -f "libnetcdff.la" && ln -s "../libnetcdff.la" "libnetcdff.la" )

ar: u' modifier ignored since D’ is the default (see `U’)

Would you please give me some idea to solve this issue?

Best Regards,

Néstor Waldyd

Hi Nestor,

“nc_inq_path” is defined in “libdispatch/dfile.c” and should be included in libnetcdf.a. Why it’s not, I have no idea but most likely a configuration issue.

Do you need to get the NetCDF source from this GIT repository? If so, I’d suggest you contact the person who maintains it.

If not, try garbing the current tar packages from Unidata’s web site (netCDF Downloads). That where I get the source and don’t see any problems when building.

  • Mat