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

[netCDF #RWU-267828]: Netcdf Fortran configure error



Hello,

Looking at the file config.log-netcdf-fortran, I see many messages similar to 
the following:

/usr/local/netcdf-intel-mpi/netcdf-c-4.7.2/lib/libnetcdf.a(libnchdf5_la-hdf5var.o):
 In function `NC4_HDF5_set_var_chunk_cache':
hdf5var.c:(.text+0x5f69): undefined reference to `H5open'
hdf5var.c:(.text+0x5f6f): undefined reference to `H5P_CLS_DATASET_ACCESS_g'
hdf5var.c:(.text+0x5f74): undefined reference to `H5Pcreate'
hdf5var.c:(.text+0x5f9b): undefined reference to `H5Pset_chunk_cache'
hdf5var.c:(.text+0x5fa7): undefined reference to `H5Dclose'
hdf5var.c:(.text+0x5fba): undefined reference to `H5Dopen2'
hdf5var.c:(.text+0x5fc9): undefined reference to `H5Pclose'
/usr/local/netcdf-intel-mpi/netcdf-c-4.7.2/lib/libnetcdf.a(libnchdf5_l

It appears that the linker is trying to link against the static libnetcdf.a 
instead of the dynamic library you compiled.  There are two solutions I can 
think of.

First, you could recompile netcdf-c and in addition to specifying 
--enable-shared, specify --disable-static. This will prevent the static library 
from being built. 

Alternatively, you could modify how you configure netCDF-Fortran as follows:

    $ ./configure --prefix=/usr/local/netcdf-intel-mpi/netcdf-fortran-4.5.2 
--enable-shared --enable-pnetcdf --enable-parallel-tests --host=x86_64 
--disable-dap $(nc-config --libs --static)

Note the addition of "$(nc-config --libs --static)" on the end.  This will 
specify the compiler flags needed to properly link against the downstream 
dependencies when linking against static libnetcdf.  You can invoke 'nc-config 
--libs --static' from the command line if you want to see what the output it. 

Let me know if this doesn't resolve the issue. Have a great day,

-Ward


> Dear all:
> 
> I was tring to compile the NETCDF with parallel support with intel
> compiler. And installation sequence is 1)zlib-1.2.8 2) szip-2.1 3)
> hdf5-1.8.13 4) pnetcdf-1.12.1 5) netcdf-c-4.7.2 6)netcdf-fortran-4.5.2
> . I installed the former 5 parts with no problem. But I encountered with
> configure error when I was trying to configure Netcdf Fortran. And
> the error message is "configure: error: Could not link to netcdf
> C library. Please set LDFLAGS." Which I am quite confused since I
> already set the netcdf-c library path in the LDFLAGS.  The attachment
> is netcdf-fortran config.log and   in case you need it I also upload
> the netcdf-c config.log. Hope you can have some opinion on this
> problem. THANKS.
> 
> Sincerely
> 
> FYI: Here is the sentence I used to configure netcdf-fortran.
> 
> CPPFLAGS="-I/usr/local/netcdf-intel-mpi/hdf5-1.8.13/include 
> -I/usr/local/netcdf-intel-mpi/pnetcdf-1.12.1/include 
> -I/usr/local/netcdf-intel-mpi/netcdf-c-4.7.2/include" 
> LDFLAGS="-L/usr/local/netcdf-intel-mpi/hdf5-1.8.13/lib -lhdf5_hl -lhdf5 -lz 
> -lm -L/usr/local/netcdf-intel-mpi/pnetcdf-1.12.1/lib -lpnetcdf 
> -L/usr/local/netcdf-intel-mpi/netcdf-c-4.7.2/lib 
> -L/opt/impi/5.0.1.035/intel64/lib" ./configure 
> --prefix=/usr/local/netcdf-intel-mpi/netcdf-fortran-4.5.2 --enable-shared 
> --enable-pnetcdf --enable-parallel-tests --host=x86_64 --disable-dap
> 
> 


Ticket Details
===================
Ticket ID: RWU-267828
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.