[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #OCU-276804]: nf_test in netcdf-4.1.3 fails with undefined reference



Hi,

> I am sorry to trouble you.
> I am trying to install netcdf-4.1.3 by configuring as:
> ../netcdf-4.1.3/configure --prefix=/home/xiaodong/pylith 
> CPPFLAGS="-I/home/xiaodong/pylith/include " 
> LDFLAGS="-L/home/xiaodong/pylith/lib " CFLAGS="-g -O2" CXXFLAGS="-g -O2 
> -DMPICH_IGNORE_CXX_SEEK -DgFortran" FCFLAGS="-g -O2 -DgFortran " 
> CC=/home/xiaodong/pylith/bin/mpicc CXX=/home/xiaodong/pylith/bin/mpicxx 
> FC=/home/xiaodong/pylith/bin/mpif90 --enable-shared --disable-static 
> --disable-netcdf-4 --disable-dap
> 
> appendix is the config.log

I didn't see a config.log attachment, but perhaps the question can be answered 
without it.

Try adding -DgFortran to CPPFLAGS, e.g.

  CPPFLAGS="-I/home/xiaodong/pylith/include -DgFortran"

> sudo make check

Usually it's better to only use "sudo" for "sudo make install", and to just run 
the configure
script and "make check" without "sudo", because some systems do not pass all the
environment variables to a shell run with "sudo", as a security measure.  That 
may not
be the case for the problem you are seeing, but it might work to just try 
running "make
check" using a new distribution, as "make check" won't be able to overwrite 
files written
with sudo.

Also, the link errors you are seeing are all for the Fortran77 API:

> /home/xiaodong/build/pylith/netcdf-build/nf_test/../../netcdf-4.1.3/nf_test/test_put.F:6372:
>  undefined reference to `nf_put_att_int2_'
> /home/xiaodong/build/pylith/netcdf-build/nf_test/../../netcdf-4.1.3/nf_test/test_put.F:6387:
>  undefined reference to `nf_put_att_int2_'

So it may be necessary to set F77=mpif77 and FFLAGS="-g -O2 -DgFortran".  For 
the mpi wrappers, we
typically set PATH to include the directory in which mpicc, mpif90, and mpif77 
are found, and then just
use the names rather than the whole path for the compilers, e.g. CC=mpicc 
FC=mpif90 F77=mpif77.
That's because the macros in cfortran.h test on the compiler names.

Some users find it easier to build just the C library in version 4.2.1.1 of 
netCDF, and then build the Fortran
version 4.2 netCDF library separately after the C library is installed, as 
described in these instructions:

  http://www.unidata.ucar.edu/software/netcdf/docs/building.html
  http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-fortran-install.html

--Russ
Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: OCU-276804
Department: Support netCDF
Priority: Normal
Status: Closed