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

[netCDF #DKH-971554]: netcdf linking problems with gotm (and fvcom)



Hi Charles,

> Hi I am trying to get the 3-D getm application running for the
> oceanography group at Texas A&M at Galveston. I run into problems
> when building gotm (prerequisite of getm). I have curl, szip, zlibs,
> and hdf5(with parallel and mpiicc) installed in /usr/local icc version
> 15.0.1 (gcc version 4.8.2 compatibility) ifort version 15.0.1 and built
> netcdf with the compiler flags from
> 
> https://software.intel.com/en-us/articles/performance-tools-for-software-developers-building-netcdf-with-the-intel-compilers
>
> Make check had no failures and netcdf install also in /usr/local
> 
> I built both netcdf-4.3.3.1 and netcdf-fortran-4.4.2

The Intel instructions are for a 4-year-old netCDF version that combined
source and build instructions for C and Fortran libraries into a single
release package.

For building and installing the latest versions, it's OK to use the special
Intel compiler flags, but for environment variable settings I think you
should use current instructions for the separate C and Fortran libraries,
especially with regard to setting CPPFLAGS and LDFLAGS environment
variables before running the configure scripts, and LD_LIBRARY_PATH in
special cases described for the Fortran library build:

  
http://www.unidata.ucar.edu/netcdf/docs/getting_and_building_netcdf.html#building
  http://www.unidata.ucar.edu/netcdf/docs/building_netcdf_fortran.html

We don't currently test on Intel compilers, so can't duplicate the problems
you see. 

But you might also try the additional recommendations that solved a very
similar problem here:

  https://groups.google.com/forum/#!topic/getm-users/IDFX_q33IXY

In particular, there is a suggestion to add 

  export NETCDFLIBNAME="-lnetcdff -lnetcdf"

before building gotm, because the netCDF Fortran library is distinct from
the netCDF C library and you need both.

--Russ

> Failure occurs at the linking of gotm modules and netcdf to create the gotm
> executable:
> 
> ifort -o gotm_prod_IFORT ./gotm/main.o  -DIFORT -DNETCDF_FMT -DSEAGRASS
> -DBIO -DPRODUCTION  -DFORTRAN95 -DREAL_4B=real\(4\) -O3  -module
> /home/chuck/gotm-4.0.0/modules/IFORT  -I/usr/local/include
> -I/usr/local/include -I/home/chuck/gotm-4.0.0/include
> -I/home/chuck/gotm-4.0.0/modules/IFORT -w95
> -L/home/chuck/gotm-4.0.0/lib/IFORT -lgotm_prod  -lseagrass_prod -lbio_prod
> -lairsea_prod -lmeanflow_prod -lturbulence_prod -lobservations_prod
> -loutput_prod -lutil_prod  /usr/local/lib/libnetcdf.a
> ifort: command line remark #10148: option '-w95' not supported
> /home/chuck/gotm-4.0.0/lib/IFORT/liboutput_prod.a(ncdfout.o): In function
> `ncdfout_mp_do_ncdf_out_':
> ncdfout.F90:(.text+0x14fe): undefined reference to `nf_sync_'
> ncdfout.F90:(.text+0x1535): undefined reference to `nf_strerror_'
> /home/chuck/gotm-4.0.0/lib/IFORT/liboutput_prod.a(ncdfout.o): In function
> `ncdfout_mp_store_data_':
> ncdfout.F90:(.text+0x1831): undefined reference to `nf_put_var_int_'
> ncdfout.F90:(.text+0x187b): undefined reference to `nf_put_vara_int_'
> ncdfout.F90:(.text+0x1932): undefined reference to `nf_strerror_'
> ncdfout.F90:(.text+0x19f5): undefined reference to `nf_put_vara_real_'
> ncdfout.F90:(.text+0x1a65): undefined reference to `nf_put_vara_real_'
> ncdfout.F90:(.text+0x1b16): undefined reference to `nf_put_var_real_'
> ncdfout.F90:(.text+0x1ced): undefined reference to `nf_put_vara_real_'
> /home/chuck/gotm-4.0.0/lib/IFORT/liboutput_prod.a(ncdfout.o): In function
> `ncdfout_mp_close_ncdf_':
> 
> My environment and cflags as well as output of nc-config and nf-config
> follows:
> export NETCDFHOME=/usr/local
> export NETCDFINC=$NETCDFHOME/include
> export NETCDFLIBNAME=$NETCDFHOME/lib/libnetcdf.a
> export FORTRAN_COMPILER=IFORT
> export GOTMDIR=/home/chuck/gotm-4.0.0
> 
> export NETCDF_VERSION=NETCDF4
> 
> export CC=icc
> export CXX=icpc
> export CFLAGS='-O3 -xHost -ip -no-prec-div -static-intel'
> export CXXFLAGS='-O3 -xHost -ip -no-prec-div -static-intel'
> export F77=ifort
> export FC=ifort
> export F90=ifort
> export FFLAGS='-O3 -xHost -ip -no-prec-div -static-intel'
> export CPP='icc -E'
> export CXXCPP='icpc -E'
> 
> [chuck@localhost src]$ nf-config --all
> 
> This netCDF-Fortran 4.4.2 has been built with the following features:
> 
> --cc        -> icc
> --cflags    ->  -I/usr/local/include
> 
> --fc        -> ifort
> --fflags    -> -I/usr/local/include
> --flibs     -> -L/usr/local/lib -lnetcdff  -lnetcdf -lnetcdf
> --has-f90   -> no
> --has-f03   -> yes
> 
> --has-nc2   -> yes
> --has-nc4   -> yes
> 
> --prefix    -> /usr/local
> --includedir-> /usr/local/include
> --version   -> netCDF-Fortran 4.4.2
> 
> [chuck@localhost src]$ nc-config --all
> 
> This netCDF 4.3.3.1 has been built with the following features:
> 
> --cc        -> icc
> --cflags    ->  -I/usr/local/include
> --libs      -> -L/usr/local/lib -lnetcdf
> 
> --has-c++   -> no
> --cxx       ->
> --has-c++4  -> no
> --cxx4      ->
> 
> --fc        -> ifort
> --fflags    -> -I/usr/local/include
> --flibs     -> -L/usr/local/lib -lnetcdff -lnetcdf -lnetcdf
> --has-f90   -> no
> 
> --has-dap   -> yes
> --has-nc2   -> yes
> --has-nc4   -> yes
> --has-hdf5  -> yes
> --has-hdf4  -> no
> --has-pnetcdf-> no
> 
> --prefix    -> /usr/local
> --includedir-> /usr/local/include
> --version   -> netCDF 4.3.3.1
> 
> So, any suggestions? I forgot to comment out -w95 in compiler config file,
> but that seems harmless. But reminds me to include the compiler.IFORT
> settings for gotm:
> cat compiler.IFORT
> # Set options for the Intel Fortran 95 compiler - ver. 8.
> ifeq ($(FORTRAN_COMPILER),IFORT)
> FC=ifort
> DEFINES += -DFORTRAN95
> can_do_F90=true
> F90_to_f90=
> MODULES=
> MODULES=-module $(MODDIR)
> EXTRAS  = -w95 -e95
> EXTRAS  = -w95
> DEBUG_FLAGS = -g -C
> PROF_FLAGS  = -qp -p
> PROD_FLAGS  = -O3
> DEFINES += -DREAL_4B=real\(4\)
> endif
> 
> I had earlier given up with fvcom which also had netcdf issues, but also I
> didn' t seem to be able to get the mpi-wrapped compilers to behave.
> 
> Thanks for any help you can offer.
> --
> Charles Folden
> 
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> If you wear your wisdom around your neck
> like a string of pearls and not a chain --
> You are a Lucky Man!
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> 
> 
Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: DKH-971554
Department: Support netCDF
Priority: Normal
Status: Closed