You should build HDF4 with ./configure --disable-netcdf to avoid the multiple
definition of netCDF API error.
By the default configuration, HDF4 also supports the netCDF-3 APIs.
Kent
From: netcdfgroup-bounces@xxxxxxxxxxxxxxxx
[mailto:netcdfgroup-bounces@xxxxxxxxxxxxxxxx] On Behalf Of Puneet Singh
Sent: Friday, March 25, 2016 5:30 AM
To: netcdfgroup@xxxxxxxxxxxxxxxx
Subject: [netcdfgroup] Regarding multiple definition of ncvar*
Dear Sir,
I am trying to compile netcdf-4.3.3.1 on centos 6.5 and i am facing following
error with intel as well as gnu compilers.My configure line was:
CC="icc" CFLAGS="-fPIC" LDFLAGS="-L$SZIP_LIBRARY -L$JPEG_LIBRARY" LIBS="-ljpeg
-lsz" ./configure
--prefix="/home/apps/NETCDF/c/4.3.3.1/intel<http://4.3.3.1/intel>"
--enable-hdf4 --enable-netcdf-4 --with-szlib="$SZIP_ROOT"
--with-zlib="$ZLIB_ROOT" --with-hdf5="$HDF5_ROOT" --enable-shared
libtool: link: gcc -shared -fPIC -DPIC .libs/libnetcdf_la-stub.o
-Wl,--whole-archive ../libdispatch/.libs/libnetcdf2.a
../libdispatch/.libs/libdispatch.a ../libsrc/.libs/libnetcdf3.a
../libdap2/.libs/libdap2.a ../oc2/.libs/liboc.a ../libsrc4/.libs/libnetcdf4.a
-Wl,--no-whole-archive -Wl,-rpath -Wl,/home/apps/HDF/5/1.8.16/intel/lib
-Wl,-rpath -Wl,/home/apps/SZIP/2.1/gnu/lib -Wl,-rpath
-Wl,/home/apps/HDF/5/1.8.16/intel/lib -Wl,-rpath
-Wl,/home/apps/SZIP/2.1/gnu/lib -L/home/apps/SZIP/2.1/gnu/lib
-L/home/apps/LIBJPEG/6b/gnu/lib -L/home/apps/ZLIB/1.2.8/gnu/lib -lrt -lz
/home/apps/HDF/4/4.2.11/intel/lib/libmfhdf.a
/home/apps/HDF/4/4.2.11/intel/lib/libdf.a
/home/apps/HDF/5/1.8.16/intel/lib/libhdf5_hl.so
/home/apps/HDF/5/1.8.16/intel/lib/libhdf5.so -ldl -lm -lcurl -ljpeg
/home/apps/SZIP/2.1/gnu/lib/libsz.so -Wl,-soname -Wl,libnetcdf.so.7 -o
.libs/libnetcdf.so.7.2.0
/home/apps/HDF/4/4.2.11/intel/lib/libmfhdf.a(putget.o): In function `ncvarput1':
putget.c:(.text+0x110): multiple definition of `ncvarput1'
../libdispatch/.libs/libnetcdf2.a(libnetcdf2_la-dv2i.o):dv2i.c:(.text+0x1050):
first defined here
/home/apps/HDF/4/4.2.11/intel/lib/libmfhdf.a(putget.o): In function `ncvarget1':
putget.c:(.text+0x810): multiple definition of `ncvarget1'
../libdispatch/.libs/libnetcdf2.a(libnetcdf2_la-dv2i.o):dv2i.c:(.text+0x10c4):
first defined here
/home/apps/HDF/4/4.2.11/intel/lib/libmfhdf.a(putget.o): In function `ncvarput':
putget.c:(.text+0xef0): multiple definition of `ncvarput'
../libdispatch/.libs/libnetcdf2.a(libnetcdf2_la-dv2i.o):dv2i.c:(.text+0x1138):
first defined here
/home/apps/HDF/4/4.2.11/intel/lib/libmfhdf.a(putget.o): In function `ncvarget':
putget.c:(.text+0x39c0): multiple definition of `ncvarget'
../libdispatch/.libs/libnetcdf2.a(libnetcdf2_la-dv2i.o):dv2i.c:(.text+0x11bf):
first defined here
/home/apps/HDF/4/4.2.11/intel/lib/libmfhdf.a(putget.o): In function `ncrecinq':
putget.c:(.text+0x3c90): multiple definition of `ncrecinq'
../libdispatch/.libs/libnetcdf2.a(libnetcdf2_la-dv2i.o):dv2i.c:(.text+0x1966):
first defined here
/home/apps/HDF/4/4.2.11/intel/lib/libmfhdf.a(putget.o): In function `ncrecput':
putget.c:(.text+0x3f70): multiple definition of `ncrecput'
../libdispatch/.libs/libnetcdf2.a(libnetcdf2_la-dv2i.o):dv2i.c:(.text+0x1ae2):
first defined here
/home/apps/HDF/4/4.2.11/intel/lib/libmfhdf.a(putget.o): In function `ncrecget':
putget.c:(.text+0x4ab0): multiple definition of `ncrecget'
../libdispatch/.libs/libnetcdf2.a(libnetcdf2_la-dv2i.o):dv2i.c:(.text+0x1a81):
first defined here
/home/apps/HDF/4/4.2.11/intel/lib/libmfhdf.a(putgetg.o): In function
`ncvarputg':
putgetg.c:(.text+0x0): multiple definition of `ncvarputg'
I wish to compile netcdf with hdf4+5 support. Any help/hint/pointers will be
very useful. Eagerly awaiting your replies.
Thanks & Regards,
Puneet Singh