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

[netCDF #DNR-108136]: Having problems when building NetCDF-Fortran with static libraries



Hello,

Try modifying your configure command as follows:

    ./configure --prefix=/home/oriol/wrf-compiled/opt/netcdf-4.7.3/lib 
--disable-shared $(nc-config --libs --static) $(nc-config --cflags)

This assumes that `nc-config` is on your path; if it is not, use the absolute 
path to nc-config.  Give this a try and let me know if it resolves the issue, 
thanks!

-Ward


> Hello,
> 
> I'm having problems when building NetCDF-Fortran 4.5.2 with static libraries. 
> Required libraries (ZLIB, SZIP, HDF5, PNETCDF and NETCDF-C) are compiled 
> statically without any problem. But for NetCDF-Fortran I'm getting this 
> errors:
> 
> ./configure --prefix=/home/oriol/wrf-compiled/opt/netcdf-4.7.3/lib 
> --disable-shared
> 
> [...]
> checking for MPI_File_open... yes
> checking netcdf.h usability... yes
> checking netcdf.h presence... yes
> checking for netcdf.h... yes
> checking for library containing nc_open... no
> configure: error: Could not link to netcdf C library. Please set LDFLAGS.
> 
> The output of the config.log file is (find the full config.log file attached 
> to this mail):
> 
> [...]
> configure:22752: checking netcdf.h usability
> configure:22752: mpiicc -c -m64 -O3 -xHost -ip -no-prec-div -static-intel 
> -fPIC  -I/home/oriol/wrf-compiled/opt/zlib-1.2.11/include 
> -I/home/oriol/wrf-compiled/opt/libpng-1.6.37/include 
> -I/home/oriol/wrf-compiled/opt/szip-2.1.1/include 
> -I/home/oriol/wrf-compiled/opt/hdf5-1.10.6/include 
> -I/home/oriol/wrf-compiled/opt/pnetcdf-1.12.1/include 
> -I/home/oriol/wrf-compiled/opt/netcdf-4.7.3/include conftest.c >&5
> configure:22752: $? = 0
> configure:22752: result: yes
> configure:22752: checking netcdf.h presence
> configure:22752: mpiicc -E  
> -I/home/oriol/wrf-compiled/opt/zlib-1.2.11/include 
> -I/home/oriol/wrf-compiled/opt/libpng-1.6.37/include 
> -I/home/oriol/wrf-compiled/opt/szip-2.1.1/include 
> -I/home/oriol/wrf-compiled/opt/hdf5-1.10.6/include 
> -I/home/oriol/wrf-compiled/opt/pnetcdf-1.12.1/include 
> -I/home/oriol/wrf-compiled/opt/netcdf-4.7.3/include conftest.c
> configure:22752: $? = 0
> configure:22752: result: yes
> configure:22752: checking for netcdf.h
> configure:22752: result: yes
> configure:22764: checking for library containing nc_open
> configure:22795: mpiicc -o conftest -m64 -O3 -xHost -ip -no-prec-div 
> -static-intel -fPIC  -I/home/oriol/wrf-compiled/opt/zlib-1.2.11/include 
> -I/home/oriol/wrf-compiled/opt/libpng-1.6.37/include 
> -I/home/oriol/wrf-compiled/opt/szip-2.1.1/include 
> -I/home/oriol/wrf-compiled/opt/hdf5-1.10.6/include 
> -I/home/oriol/wrf-compiled/opt/pnetcdf-1.12.1/include 
> -I/home/oriol/wrf-compiled/opt/netcdf-4.7.3/include  
> -L/home/oriol/wrf-compiled/opt/zlib-1.2.11/lib 
> -L/home/oriol/wrf-compiled/opt/libpng-1.6.37/lib 
> -L/home/oriol/wrf-compiled/opt/libpng-1.6.37/lib 
> -L/home/oriol/wrf-compiled/opt/szip-2.1.1/lib 
> -L/home/oriol/wrf-compiled/opt/hdf5-1.10.6/lib 
> -L/home/oriol/wrf-compiled/opt/pnetcdf-1.12.1/lib 
> -L/home/oriol/wrf-compiled/opt/netcdf-4.7.3/lib conftest.c -lm  -lz -lpng 
> -lsz -lhdf5_hl -lhdf5 -lpnetcdf -lnetcdf >&5
> icc: warning #10237: -lcilkrts linked in dynamically, static library not 
> available
> /home/oriol/wrf-compiled/opt/netcdf-4.7.3/lib/libnetcdf.a(libnetcdfp_la-ncpdispatch.o):
>  In function `NCP_create':
> ncpdispatch.c:(.text+0x5b): undefined reference to `ncmpi_create'
> [...]
> 
> The environment variables are (set by: export ENV_VAR="value"):
> 
> LD_LIBRARY_PATH = 
> /opt/intel/compilers_and_libraries_2019.5.281/linux/compiler/lib/intel64_lin:/opt/intel/compilers_and_libraries_2019.5.281/linux/mpi/intel64/libfabric/lib:/opt/intel/compilers_and_libraries_2019.5.281/linux/mpi/intel64/lib/release:/opt/intel/compilers_and_libraries_2019.5.281/linux/mpi/intel64/lib:/opt/intel/compilers_and_libraries_2019.5.281/linux/tbb/lib/intel64/gcc4.7:/opt/intel/compilers_and_libraries_2019.5.281/linux/tbb/lib/intel64/gcc4.7:/home/oriol/wrf-compiled/opt/zlib-1.2.11/lib:/home/oriol/wrf-compiled/opt/szip-2.1.1/lib:/home/oriol/wrf-compiled/opt/hdf5-1.10.6/lib:/home/oriol/wrf-compiled/opt/pnetcdf-1.12.1/lib:/home/oriol/wrf-compiled/opt/netcdf-4.7.3/lib
> 
> CPPFLAGS = -I/home/oriol/wrf-compiled/opt/zlib-1.2.11/include 
> -I/home/oriol/wrf-compiled/opt/libpng-1.6.37/include 
> -I/home/oriol/wrf-compiled/opt/szip-2.1.1/include 
> -I/home/oriol/wrf-compiled/opt/hdf5-1.10.6/include 
> -I/home/oriol/wrf-compiled/opt/pnetcdf-1.12.1/include 
> -I/home/oriol/wrf-compiled/opt/netcdf-4.7.3/include
> 
> LDFLAGS = -L/home/oriol/wrf-compiled/opt/zlib-1.2.11/lib 
> -L/home/oriol/wrf-compiled/opt/libpng-1.6.37/lib 
> -L/home/oriol/wrf-compiled/opt/libpng-1.6.37/lib 
> -L/home/oriol/wrf-compiled/opt/szip-2.1.1/lib 
> -L/home/oriol/wrf-compiled/opt/hdf5-1.10.6/lib 
> -L/home/oriol/wrf-compiled/opt/pnetcdf-1.12.1/lib 
> -L/home/oriol/wrf-compiled/opt/netcdf-4.7.3/lib
> 
> The compilers used for all the libraries are:
> 
> CC=mpiicc
> CXX=mpiicpc
> FC=mpiifort
> F77=mpiifort
> F90=mpiifort
> F9X=mpiifort
> CFLAGS='-m64 -O3 -xHost -ip -no-prec-div -static-intel -fPIC'
> CXXFLAGS='-m64 -O3 -xHost -ip -no-prec-div -static-intel -fPIC'
> FFLAGS='-m64 -O3 -xHost -ip -no-prec-div -static-intel -fPIC'
> 
> It seems that NetCDF-Fortran cannot find the NetCDF-C static library, but the 
> static library is still there:
> 
> ls -l /home/oriol/wrf-compiled/opt/netcdf-4.7.3/lib
> total 1836
> -rw-r--r--. 1 root root 1868740 Feb 19 13:59 libnetcdf.a
> -rwxr-xr-x. 1 root root    1441 Feb 19 13:59 libnetcdf.la
> -rw-r--r--. 1 root root    1581 Feb 19 13:59 libnetcdf.settings
> drwxr-xr-x. 2 root root      23 Feb 19 13:59 pkgconfig
> 
> The content of libnetcdf.settings is:
> 
> # NetCDF C Configuration Summary
> ==============================
> 
> # General
> -------
> NetCDF Version:         4.7.3
> Dispatch Version:       1
> Configured On:          Wed Feb 19 13:58:56 UTC 2020
> Host System:            x86_64-pc-linux-gnu
> Build Directory:        /tmp/netcdf-c-4.7.3
> Install Prefix:         /home/oriol/wrf-compiled/opt/netcdf-4.7.3
> 
> # Compiling Options
> -----------------
> C Compiler:             
> /opt/intel/compilers_and_libraries_2019.5.281/linux/mpi/intel64/bin/mpiicc
> CFLAGS:                 -m64 -O3 -xHost -ip -no-prec-div -static-intel -fPIC
> CPPFLAGS:                -I/home/oriol/wrf-compiled/opt/zlib-1.2.11/include 
> -I/home/oriol/wrf-compiled/opt/libpng-1.6.37/include 
> -I/home/oriol/wrf-compiled/opt/szip-2.1.1/include 
> -I/home/oriol/wrf-compiled/opt/hdf5-1.10.6/include 
> -I/home/oriol/wrf-compiled/opt/pnetcdf-1.12.1/include
> LDFLAGS:                 -L/home/oriol/wrf-compiled/opt/zlib-1.2.11/lib 
> -L/home/oriol/wrf-compiled/opt/libpng-1.6.37/lib 
> -L/home/oriol/wrf-compiled/opt/libpng-1.6.37/lib 
> -L/home/oriol/wrf-compiled/opt/szip-2.1.1/lib 
> -L/home/oriol/wrf-compiled/opt/hdf5-1.10.6/lib 
> -L/home/oriol/wrf-compiled/opt/pnetcdf-1.12.1/lib
> AM_CFLAGS:
> AM_CPPFLAGS:
> AM_LDFLAGS:
> Shared Library:         no
> Static Library:         yes
> Extra libraries:        -lpnetcdf -lhdf5_hl -lhdf5 -lm  -lz -lpng -lsz 
> -lhdf5_hl -lhdf5 -lpnetcdf
> 
> # Features
> --------
> NetCDF-2 API:           yes
> HDF4 Support:           no
> HDF5 Support:           yes
> NetCDF-4 API:           yes
> NC-4 Parallel Support:  yes
> PnetCDF Support:        yes
> DAP2 Support:           no
> DAP4 Support:           no
> Byte-Range Support:     no
> Diskless Support:       yes
> MMap Support:           no
> JNA Support:            no
> CDF5 Support:           yes
> ERANGE Fill Support:    yes
> Relaxed Boundary Check: yes
> 
> 
> Please, could you help me solving the issue?
> 
> Thanks in advance,
> 
> Oriol
> 
> 
> 


Ticket Details
===================
Ticket ID: DNR-108136
Department: Support netCDF
Priority: Normal
Status: Closed
===================
NOTE: All email exchanges with Unidata User Support are recorded in the Unidata 
inquiry tracking system and then made publicly available through the web.  If 
you do not want to have your interactions made available in this way, you must 
let us know in each email you send to us.