Monday, 15 September 2014

fortran - Compiling program using gfortran and the HDF-EOS2 library -



fortran - Compiling program using gfortran and the HDF-EOS2 library -

i have problem of linking hdf-eos library fortran90 program. have compiled library source directory specified in $prefix. simple compile command is:

gfortran -i$prefix/include -l$prefix/lib -wl,-rpath -wl,$prefix/lib -lhdfeos -lgctp -lmfhdf -ldf -lz -lsz -ljpeg tst.f90

when compiling, next error:

undefined reference `gdopen_'

in program, not supposed change, hdf-eos library used via external keyword, e.g.

integer(kind=4), external :: gdopen

in library, nm $prefix/lib/libhdfeos.a | grep gdopen gives me:

00000000000120c0 t gdopen

when compiling -fno-underscoring, different error:

gfortran -fno-underscoring -i$prefix/include -l$prefix/lib -wl,-rpath -wl,$prefix/lib -lhdfeos -lgctp -lmfhdf -ldf -lz -lsz -ljpeg tst.f90

the error then:

undefined reference `gdopen'

also, gfortran finds libraries, otherwise complain. error related underscore? else can try? work on fedora , gfortran version 4.7.2.

yes, caused underscore.

try compiling -fno-underscoring (https://gcc.gnu.org/onlinedocs/gfortran/code-gen-options.html), fixing proper bind(c) interface better.

this tutorial (did read before going here? easy find finish novice in library, me.) states should utilize -fno-underscoring.

continue implementing rest tutorial recommends, including compiling fc=$(hdf4_dir)/bin/h4fc.

fortran fortran90 gfortran hdf

No comments:

Post a Comment