Skip navigation
NASA Logo, National Aeronautics and Space Administration
5839 Views 0 Replies Latest reply: Mar 18, 2008 5:34 PM by swartzbr RSS
Currently Being Moderated

Mar 18, 2008 5:34 PM

Problems linking with HDF library

 

When linking an application which uses HDF5 on discover, the application would not link, as shown here:

 

 

swartzbr@discover07:~/IOR/IOR-2.10.1/src/C> gmake hdf5

mpicc -lmpio -L/usr/local/other/hdf/5-1.8.0_parallel/lib -lhdf5 -lm -lz -o IOR IOR.o utilities.o parse_options.o \

        aiori-POSIX.o aiori-MPIIO.o aiori-HDF5.o aiori-noNCMPI.o

aiori-HDF5.o(.text+0x171): In function `IOR_Open_HDF5':

/gpfsm/dhome/swartzbr/IOR/IOR-2.10.1/src/C/aiori-HDF5.c:154: undefined reference to `H5check_version'

aiori-HDF5.o(.text+0x1b7):/gpfsm/dhome/swartzbr/IOR/IOR-2.10.1/src/C/aiori-HDF5. c:158: undefined reference to `H5check_version'

aiori-HDF5.o(.text+0x201):/gpfsm/dhome/swartzbr/IOR/IOR-2.10.1/src/C/aiori-HDF5. c:162: undefined reference to `H5check_version'

aiori-HDF5.o(.text+0x224):/gpfsm/dhome/swartzbr/IOR/IOR-2.10.1/src/C/aiori-HDF5. c:163: undefined reference to `H5check_version'

aiori-HDF5.o(.text+0x247):/gpfsm/dhome/swartzbr/IOR/IOR-2.10.1/src/C/aiori-HDF5. c:164: undefined reference to `H5check_version'

aiori-HDF5.o(.text+0x27a):/gpfsm/dhome/swartzbr/IOR/IOR-2.10.1/src/C/aiori-HDF5. c:170: undefined reference to `H5open'

aiori-HDF5.o(.text+0x280):/gpfsm/dhome/swartzbr/IOR/IOR-2.10.1/src/C/aiori-HDF5. c:170:

undefined reference to `H5P_CLS_FILE_CREATE_g'

aiori-HDF5.o(.text+0x287):/gpfsm/dhome/swartzbr/IOR/IOR-2.10.1/src/C/aiori-HDF5. c:170: undefined reference to `H5Pcreate'

aiori-HDF5.o(.text+0x31d):/gpfsm/dhome/swartzbr/IOR/IOR-2.10.1/src/C/aiori-HDF5. c:173: undefined reference to `H5Pset_sizes'

aiori-HDF5.o(.text+0x39e):/gpfsm/dhome/swartzbr/IOR/IOR-2.10.1/src/C/aiori-HDF5. c:177: undefined reference to `H5open'

aiori-HDF5.o(.text+0x3a4):/gpfsm/dhome/swartzbr/IOR/IOR-2.10.1/src/C/aiori-HDF5. c:177:

undefined reference to `H5P_CLS_FILE_ACCESS_g'

aiori-HDF5.o(.text+0x3ab):/gpfsm/dhome/swartzbr/IOR/IOR-2.10.1/src/C/aiori-HDF5. c:177: undefined reference to `H5Pcreate'

aiori-HDF5.o(.text+0x4d1):/gpfsm/dhome/swartzbr/IOR/IOR-2.10.1/src/C/aiori-HDF5. c:203: undefined reference to `H5Pset_fapl_mpio'

aiori-HDF5.o(.text+0x573):/gpfsm/dhome/swartzbr/IOR/IOR-2.10.1/src/C/aiori-HDF5. c:207: undefined reference to `H5Pset_alignment'

aiori-HDF5.o(.text+0x61c):/gpfsm/dhome/swartzbr/IOR/IOR-2.10.1/src/C/aiori-HDF5. c:212: undefined reference to `H5Fcreate'

aiori-HDF5.o(.text+0x6bd):/gpfsm/dhome/swartzbr/IOR/IOR-2.10.1/src/C/aiori-HDF5. c:216: undefined reference to `H5Fopen'

aiori-HDF5.o(.text+0x80b):/gpfsm/dhome/swartzbr/IOR/IOR-2.10.1/src/C/aiori-HDF5. c:228:

undefined reference to `H5Fget_access_plist'

aiori-HDF5.o(.text+0x832):/gpfsm/dhome/swartzbr/IOR/IOR-2.10.1/src/C/aiori-HDF5. c:229: undefined reference to `H5Pget_fapl_mpio'

aiori-HDF5.o(.text+0x923):/gpfsm/dhome/swartzbr/IOR/IOR-2.10.1/src/C/aiori-HDF5. c:238:

undefined reference to `H5Fget_vfd_handle'

aiori-HDF5.o(.text+0xc3d):/gpfsm/dhome/swartzbr/IOR/IOR-2.10.1/src/C/aiori-HDF5. c:255: undefined reference to `H5Pclose'

aiori-HDF5.o(.text+0xcc3):/gpfsm/dhome/swartzbr/IOR/IOR-2.10.1/src/C/aiori-HDF5. c:256: undefined reference to `H5Pclose'

aiori-HDF5.o(.text+0xd44):/gpfsm/dhome/swartzbr/IOR/IOR-2.10.1/src/C/aiori-HDF5. c:259: undefined reference to `H5open'

...

 

 

aiori-HDF5.o(.text+0x1fc0):/gpfsm/dhome/swartzbr/IOR/IOR-2.10.1/src/C/aiori-HDF5 .c:561:

undefined reference to `H5T_NATIVE_LLONG_g'

aiori-HDF5.o(.text+0x1fe0):/gpfsm/dhome/swartzbr/IOR/IOR-2.10.1/src/C/aiori-HDF5 .c:560: undefined reference to `H5Dcreate1'

aiori-HDF5.o(.text+0x208f):/gpfsm/dhome/swartzbr/IOR/IOR-2.10.1/src/C/aiori-HDF5 .c:564: undefined reference to `H5Dopen1'

gmake: *** Problems linking with HDF library Error 1

 

 

 

 

 

Answer:

 

 

The following should be used to do the linking:

 

 

/usr/local/other/hdf/5-1.6.6_parallel/bin/h5pcc

-lmpio -L/usr/local/other/hdf/5-1.6.6_parallel/lib -lhdf5 -lm -lz -o

IOR IOR.o utilities.o parse_options.o \

        aiori-POSIX.o aiori-MPIIO.o aiori-HDF5.o aiori-noNCMPI.o

A similar Fortran compiler command exists, too:

 

 

/usr/local/other/hdf/5-1.6.6_parallel/bin/h5pfc

 

 

 

 

 

 

Question:

 

 

The latest version of HDF (version

5-1.8.0) has now been installed, however problems can be seen with the

number of arguments to hdf calls, such as those shown here:

 

 

mpicc -g -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -I/usr/local/other/hdf/5-1.8.0_parallel/include -c aiori-HDF5.c

aiori-HDF5.c(561): error #165: too few arguments in function call

                              dataSpace, dataSetPropList);

                                                        ^

 

aiori-HDF5.c(564): error #165: too few arguments in function call

          dataSet = H5Dopen(*(hid_t *)fd, dataSetName);

                                                     ^

 

compilation aborted for aiori-HDF5.c (code 2)

gmake: *** http://aiori-HDF5.o Error 2

 

 

 

 

 

Answer:

 

 

This can be corrected by using the following command:

 

 

swartzbr@discover07:~/IOR/IOR-2.10.1/src/C> !gm

gmake hdf5

/usr/local/other/hdf/5-1.8.0_parallel/bin/h5pcc -DH5Dopen_vers=1

-DH5Dcreate_vers=1 -lmpio -L/usr/local/other/hdf/5-1.8.0_parallel/lib

-lhdf5 -lm -lz -o IOR IOR.o utilities.o parse_options.o \

        aiori-POSIX.o aiori-MPIIO.o aiori-HDF5.o aiori-noNCMPI.o

 

 

 

The -D definitions were required to workaround differences in the number of arguments.

 

 

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • Correct Answers - 4 points
  • Helpful Answers - 2 points
USAGov logo NASA Logo - nasa.gov