[ncl-install] Multiple definitions, undefined references while linking ncl

Jan Ploski Jan.Ploski at offis.de
Mon Jan 7 11:54:16 MST 2008


Hello,

Since my last message I got around several compilation problems:
1) Missing triangle, as described in the installation guide
2) I had to replace yy_current_buffer with YY_CURRENT_BUFFER_LVALUE in 
ni/src/ncl/Symbol.h to work around an undefined reference (related to my 
flex version again, I guess)
3) I had to make a symlink hdf -> . in HDF's include directory. Some 
source files wanted to include <hdf/hdf.h>.
4) I had to play with the order of -I options to put NetCDF before HDF. 
Both provide netcdf.h, and only NetCDF's netcdf.h defines 
NC_64BIT_OFFSET needed by some source file. This workaround was possibly 
made necessary by the symlink I created in 3).
5) I had to hack Makefiles of ictrans and ncl to add an -L option and 
-l's for pgf90 runtime libraries. I think this is because I'm using 
pgf90 and gcc together.

Had I known this would be so much fun, I would probably have tried the 
binary install first. Perhaps you should put even bigger warnings at the 
beginning of the installation guide ;-). However, having gone this far, 
I'd like to finish the installation from source. I'm now stuck again 
while trying to link ncl. The failing command line is

gcc -ansi -fPIC -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -O 
-Wl,--export-dynamic   -o ncl Ncl.o io.o NclHLUObj.o scanner.o parser.o 
MathFuncs.o NclTypedouble.o NclTypefloat.o 
NclTypeint.o NclTypelogical.o                   NclTypelong.o 
NclTypeobj.o                      NclTypeshort.o NclTypestring.o 
           NclTypebyte.o NclTypechar.o TypeSupport.o 
    NclMultiDValData.o AddFileFormats.o AttSupport.o DataSupport.o 
             FileSupport.o Formats.o GetGrids.o 
InitData.o Memory.o NclAtt.o NclCCM.o                   NclCoordVar.o 
NclData.o NclFile.o NclFileVar.o                  NclGRIB.o NclHDF.o 
NclMultiDValnclfileData.o                    NclNetCdf.o 
NclOneDValCoordData.o NclType.o                     NclTypelist.o 
NclVar.o VarSupport.o                     ctoiee.o date.o qu2reg3.o 
rowina3.o scm0.o ncepcode.o   AddBuiltIns.o AddHLUObjs.o 
       AddIntrinsics.o Execute.o                       Machine.o 
OpsFuncs.o Printtoken.o SrcTree.o                     Symbol.o 
Translate.o                    NclHLUVar.o HLUSupport.o 
        NclMultiDValHLUObjData.o                        BuiltInSupport.o 
BuiltInFuncs.o                         HLUFunctions.o yywrap.o craybin.o 
                       complete.o editline.o sysunix.o ListSupport.o 
                NclList.o NclMultiDVallistData.o fortranio.o 
-L../../.././ni/src/lib/nfp -lnfp -L../../.././ni/src/lib/nfpfort 
-lnfpfort -L../../.././ni/src/lib/hlu -lhlu 
-L../../.././ncarg2d/src/libncarg -lncarg 
-L../../.././ncarg2d/src/libncarg_gks -lncarg_gks 
-L../../.././common/src/libncarg_c -lncarg_c -L../../.././ngmath/src/lib 
-lngmath -L/home/VO_SW_DIR/wisent/ncl_ncarg-5.0.0/lib -L/usr/X11R6/lib64 
-L/home/VO_SW_DIR/wisent/bison-2.3/lib 
-L/home/VO_SW_DIR/wisent/flex-2.5.34/lib 
-L/home/VO_SW_DIR/wisent/HDF4.2r2/lib 
-L/home/VO_SW_DIR/wisent/jpeg-6b/lib 
-L/home/VO_SW_DIR/wisent/netcdf-3.6.2/lib 
-L/home/VO_SW_DIR/wisent/udunits-1.12.4/lib 
-L/direct/local/pgf90/linux86-64/6.2/lib -lnetcdf   -lmfhdf -ldf -ljpeg 
-lz -ludunits   -L../../.././external/sphere3.1_dp -lsphere3.1_dp 
-L../../.././external/fftpack5_dp -lfftpack5_dp 
-L../../.././external/lapack -llapack_ncl -L../../.././external/blas 
-lblas_ncl -lX11 -lXext -lpgf90 -lpgf90_rpm1 -lpgf902 -lpgf90rtl 
-lpgftnrtl -lpgf90 -lpgf90_rpm1 -lpgf902 -lpgf90rtl -lpgftnrtl -lnspgc 
-lpgc -lm -lm  -ldl


A representative selection of error messages is:

/home/VO_SW_DIR/wisent/HDF4.2r2/lib/libmfhdf.a(globdef.o)(.data+0x8): 
multiple definition of `ncopts'
/home/VO_SW_DIR/wisent/netcdf-3.6.2/lib/libnetcdf.a(v2i.o)(.data+0x0): 
first defined here
/home/VO_SW_DIR/wisent/HDF4.2r2/lib/libmfhdf.a(globdef.o)(.bss+0x0): 
multiple definition of `ncerr'
/home/VO_SW_DIR/wisent/netcdf-3.6.2/lib/libnetcdf.a(v2i.o)(.bss+0x0): 
first defined here
NclHDF.o(.text+0x62): In function `HDFGetAttrVal':
: undefined reference to `sd_ncattget'
NclHDF.o(.text+0xc0): In function `HDFGetAttrVal':
: undefined reference to `sd_ncattget'
NclHDF.o(.text+0xff9): In function `HDFOpenFile':
: undefined reference to `sd_ncopen'


It seems that HDF redefines some symbols provided by NetCDF? Is that 
expected - should the warnings be ignored? And where are the sd_ symbols 
supposed to come from?

Best regards,
Jan Ploski


More information about the ncl-install mailing list