[MOAB-dev] linking against MOAB

Jason Kraftcheck kraftche at cae.wisc.edu
Fri Feb 5 21:03:29 CST 2010


On 02/05/2010 05:32 PM, iulian at mcs.anl.gov wrote:
> Hello,
> I have a beginner's question on how to link against MOAB :(
>
> I don't use autotools, and I can't understand the error I am getting.
> It seems it is a problem with the version for hdf5 library.
>

Libraries (at least static ones) must be specified in order of 
reverse-dependency.  If both libnetcdf and libhdf5_hl depend on libhdf5, 
then the -lhdf5 must appear *after* both -lnetcdf and -lhdf5_hl on the 
link line.

- jason





> my makefile is below, and the error I am getting is after that.
>
> Thanks,
> Iulian
>
>
> CXX=/homes/sharp/3rdparty/mpich2/mpich2-1.1.1p1/gcc/bin/mpicxx
>
> .SUFFIXES: .cxx .cc .fd
>
>
> .cc.o:
>          $(CXX) $(CFLAGS) -c $<
>
> .cxx.o:
>          $(CXX) $(CFLAGS) -c $<
>
> .C.o:
>          $(CXX) $(CFLAGS) -c $<
>
> .fd.c:
>          fdesign -c $<
>
> .fd.h:
>          fdesign -c $<
>
>
>
> GFX2_FLAGS = -m486 -DGFX_NO_BOOL -DGFX_DEF_FMATH -Wno-deprecated
>
> include /homes/iulian/lib/MOAB/lib/moab.make
>
>
> OPTFLAGS = -O2 $(GFX2_FLAGS)
> FEATURES =
>
> CFLAGS = $(MOAB_INCLUDES) $(OPTFLAGS)
> LFLAGS = $(LIBDIR) $(OPTFLAGS)
>
> CORE_SRCS = cmdline.cxx avars.cxx decimate.cxx quadrics.cxx \
>              AdjPrims.cxx AdjModel.cxx Nvars.cxx Mat4.cxx timing.cxx \
>              smf.cxx smfstate.cxx 3D.cxx heap.cxx \
>              ProxGrid.cxx futils.cxx ProjectH.cxx
>
> QSLIM_SRCS = qslim.cxx $(CORE_SRCS)
> QSLIM_OBJS = $(QSLIM_SRCS:.cxx=.o)
>
> qslim : $(QSLIM_OBJS)
>          $(CXX) -o qslim $(QSLIM_OBJS) -lm $(MOAB_LIBS_LINK)
>
>
> clean:
>          -$(CLEAN)
>
>
> error in compiling
> ...
> /homes/sharp/3rdparty/mpich2/mpich2-1.1.1p1/gcc/bin/mpicxx -o qslim qslim.o cmdline.o avars.o decimate.o quadrics.o AdjPrims.o AdjMo
> del.o Nvars.o Mat4.o timing.o smf.o smfstate.o 3D.o heap.o ProxGrid.o futils.o ProjectH.o -lm -L/homes/sharp/3rdparty/netcdf/netcdf-
> 4.0.1/parallel/gcc/lib    -L/homes/sharp/3rdparty/zlib/zlib-1.2.3/gcc/lib -L/homes/sharp/3rdparty/szip/szip-2.1/gcc/lib  -L/homes/sh
> arp/3rdparty/hdf5/hdf5-1.8.3/parallel/gcc/lib -L/homes/iulian/lib/CGM/lib  -L/homes/sharp/3rdparty/OCC/OpenCASCADE6.3.0/gcc/lib -L/h
> omes/iulian/lib/MOAB/lib -lMOAB -lm -lhdf5  -lsz -lz -lnetcdf_c++ -lnetcdf -lhdf5_hl -lcgm  -lTKMath -lTKXSBase -lTKernel -lTKShHeal
> ing -lTKBRep -lTKG3d -lTKBO -lTKFeat -lTKFillet -lTKG2d -lTKOffset -lTKBool -lTKGeomAlgo -lTKGeomBase -lTKPrim -lTKTopAlgo -lTKHLR -
> lTKIGES -lTKMesh -lTKPrim -lTKSTEP209 -lTKSTEPAttr -lTKSTEPBase -lTKSTEP -lTKSTL -lTKTopAlgo -lTKXSBase -lTKLCAF -lTKBinL -ldl
> /homes/sharp/3rdparty/netcdf/netcdf-4.0.1/parallel/gcc/lib/libnetcdf.a(nc4hdf.o): In function `get_netcdf_type':
> /homes/smithrm/sharp/3rdparty/netcdf/netcdf-4.0.1/parallel/src/libsrc4/nc4hdf.c:1220: undefined reference to `H5Tget_native_type'
> /homes/sharp/3rdparty/netcdf/netcdf-4.0.1/parallel/gcc/lib/libnetcdf.a(nc4hdf.o): In function `nc4_open_var_grp2':
> /homes/smithrm/sharp/3rdparty/netcdf/netcdf-4.0.1/parallel/src/libsrc4/nc4hdf.c:175: undefined reference to `H5Dopen1'
> /homes/sharp/3rdparty/netcdf/netcdf-4.0.1/parallel/gcc/lib/libnetcdf.a(nc4hdf.o): In function `nc4_open_var_grp':
> /homes/smithrm/sharp/3rdparty/netcdf/netcdf-4.0.1/parallel/src/libsrc4/nc4hdf.c:152: undefined reference to `H5Dopen1'
> /homes/sharp/3rdparty/netcdf/netcdf-4.0.1/parallel/gcc/lib/libnetcdf.a(nc4hdf.o): In function `get_hdf_typeid':
> /homes/smithrm/sharp/3rdparty/netcdf/netcdf-4.0.1/parallel/src/libsrc4/nc4hdf.c:379: undefined reference to `H5Tset_strpad'
> /homes/sharp/3rdparty/netcdf/netcdf-4.0.1/parallel/gcc/lib/libnetcdf.a(nc4hdf.o): In function `pg_att_grpa':
> /homes/smithrm/sharp/3rdparty/netcdf/netcdf-4.0.1/parallel/src/libsrc4/nc4hdf.c:1751: undefined reference to `H5Tset_strpad'
> /homes/smithrm/sharp/3rdparty/netcdf/netcdf-4.0.1/parallel/src/libsrc4/nc4hdf.c:1694: undefined reference to `H5Tget_native_type'
> /homes/smithrm/sharp/3rdparty/netcdf/netcdf-4.0.1/parallel/src/libsrc4/nc4hdf.c:1674: undefined reference to `H5Tget_native_type'
> /homes/sharp/3rdparty/netcdf/netcdf-4.0.1/parallel/gcc/lib/libnetcdf.a(nc4hdf.o): In function `read_dataset':
> /homes/smithrm/sharp/3rdparty/netcdf/netcdf-4.0.1/parallel/src/libsrc4/nc4hdf.c:4343: undefined reference to `H5Dopen1'
> /homes/sharp/3rdparty/netcdf/netcdf-4.0.1/parallel/gcc/lib/libnetcdf.a(nc4hdf.o): In function `read_type':
> /homes/smithrm/sharp/3rdparty/netcdf/netcdf-4.0.1/parallel/src/libsrc4/nc4hdf.c:1828: undefined reference to `H5Tget_native_type'
> /homes/sharp/3rdparty/netcdf/netcdf-4.0.1/parallel/gcc/lib/libnetcdf.a(nc4hdf.o): In function `read_var':
> /homes/smithrm/sharp/3rdparty/netcdf/netcdf-4.0.1/parallel/src/libsrc4/nc4hdf.c:4158: undefined reference to `H5Tget_native_type'
> /homes/sharp/3rdparty/netcdf/netcdf-4.0.1/parallel/gcc/lib/libnetcdf.a(nc4hdf.o): In function `commit_type':
> /homes/smithrm/sharp/3rdparty/netcdf/netcdf-4.0.1/parallel/src/libsrc4/nc4hdf.c:2129: undefined reference to `H5Tcommit1'
> /homes/sharp/3rdparty/netcdf/netcdf-4.0.1/parallel/gcc/lib/libnetcdf.a(nc4hdf.o): In function `write_dim':
> /homes/smithrm/sharp/3rdparty/netcdf/netcdf-4.0.1/parallel/src/libsrc4/nc4hdf.c:2579: undefined reference to `H5Dextend'
> /homes/smithrm/sharp/3rdparty/netcdf/netcdf-4.0.1/parallel/src/libsrc4/nc4hdf.c:2518: undefined reference to `H5Dcreate1'
> /homes/sharp/3rdparty/netcdf/netcdf-4.0.1/parallel/gcc/lib/libnetcdf.a(nc4hdf.o): In function `var_create_dataset':
> /homes/smithrm/sharp/3rdparty/netcdf/netcdf-4.0.1/parallel/src/libsrc4/nc4hdf.c:1528: undefined reference to `H5Dcreate1'
> /homes/sharp/3rdparty/netcdf/netcdf-4.0.1/parallel/gcc/lib/libnetcdf.a(nc4hdf.o): In function `nc4_get_vara':
> /homes/smithrm/sharp/3rdparty/netcdf/netcdf-4.0.1/parallel/src/libsrc4/nc4hdf.c:1077: undefined reference to `H5Tget_native_type'
> /homes/sharp/3rdparty/netcdf/netcdf-4.0.1/parallel/gcc/lib/libnetcdf.a(nc4hdf.o): In function `nc4_put_vara':
> /homes/smithrm/sharp/3rdparty/netcdf/netcdf-4.0.1/parallel/src/libsrc4/nc4hdf.c:819: undefined reference to `H5Tget_native_type'
> /homes/smithrm/sharp/3rdparty/netcdf/netcdf-4.0.1/parallel/src/libsrc4/nc4hdf.c:792: undefined reference to `H5Dextend'
> /homes/sharp/3rdparty/hdf5/hdf5-1.8.3/parallel/gcc/lib/libhdf5_hl.a(H5LT.o): In function `H5LTmake_dataset_string':
> H5LT.c:(.text+0x136a): undefined reference to `H5Tset_strpad'
> /homes/sharp/3rdparty/hdf5/hdf5-1.8.3/parallel/gcc/lib/libhdf5_hl.a(H5LT.o): In function `H5LTset_attribute_string':
> H5LT.c:(.text+0x1976): undefined reference to `H5Tset_strpad'
> /homes/sharp/3rdparty/hdf5/hdf5-1.8.3/parallel/gcc/lib/libhdf5_hl.a(H5LT.o): In function `H5LT_set_attribute_string':
> H5LT.c:(.text+0x1b12): undefined reference to `H5Tset_strpad'
> /homes/sharp/3rdparty/hdf5/hdf5-1.8.3/parallel/gcc/lib/libhdf5_hl.a(H5LT.o): In function `H5LT_dtype_to_text':
> H5LT.c:(.text+0x2b09): undefined reference to `H5Tget_strpad'
> H5LT.c:(.text+0x2b1b): undefined reference to `H5Tget_cset'
> H5LT.c:(.text+0x30f4): undefined reference to `H5Tset_cset'
> H5LT.c:(.text+0x3106): undefined reference to `H5Tset_strpad'
> H5LT.c:(.text+0x32f0): undefined reference to `H5Tset_cset'
> H5LT.c:(.text+0x3314): undefined reference to `H5Tset_strpad'
> /homes/sharp/3rdparty/hdf5/hdf5-1.8.3/parallel/gcc/lib/libhdf5_hl.a(H5LTparse.o): In function `H5LTyyparse':
> H5LTparse.c:(.text+0xc96): undefined reference to `H5Tset_strpad'
> H5LTparse.c:(.text+0xca3): undefined reference to `H5Tset_cset'
> H5LTparse.c:(.text+0xdcf): undefined reference to `H5Tget_native_type'
> collect2: ld returned 1 exit status
> make: *** [qslim] Error 1



More information about the moab-dev mailing list