Project

General

Profile

installation problem: compiling cdo 1.9.6 with --enable-cdi-lib fails

Added by Natalja Rakowsky about 5 years ago

It is my first visit in this forum, and I hope, it is at the right place here. Or is it so specific that I should move to "Issues" immediately?

With cdo 1.9.5, everything works fine. I have never had any issues installing cdo on our Linux cluster (CentOS, now 7.5) so far. Nicht geschimpft ist genug gelobt :)

But now, with gcc 4.8.5 (also tried with gcc 7.4.0, same issue) and our own installation of netcdf, hdf5, eccodes, grib_api:

Configure with

export ECCDIR=/global/AWIsoft/eccodes/2.8.0
export UDUNITSDIR=/global/AWIsoft/udunits/2.2.26
export NETCDFDIR=/global/AWIsoft/netcdf/4.6.1_gnu
export HDF5DIR=/global/AWIsoft/hdf5/1.10.2_gnu
export GRIBDIR=/global/AWIsoft/grib_api/1.28.0
export PROJDIR=/global/AWIsoft/proj/5.1.0

LDFLAGS="-L$ECCDIR/lib -Wl,-rpath=$ECCDIR/lib -Wl,-rpath=$UDUNITSDIR/lib -Wl,-rpath=$NETCDFDIR/lib -Wl,-rpath=HDF5DIR/lib -Wl,-rpath,$GRIBDIR/lib -Wl,-rpath,$PROJDIR/lib" CXXFLAGS="-fpic" CFLAGS="-fpic" FFLAGS="-fpic" ./configure --prefix=/global/AWIsoft/cdo/1.9.6 --with-gnu-ld --with-fftw3 --with-pic --with-hdf5=$HDF5DIR --with-proj=$PROJDIR --with-netcdf=$NETCDFDIR --enable-python --with-eccodes=$ECCDIR --with-udunits2=$UDUNITSDIR --enable-cdi-lib --enable-all-static --with-grib_api=$GRIBDIR --enable-grib

works, expected output. Compilation starts fine, too, but

[...]
libtool: link: g++ -fpic -Wl,-rpath=/global/AWIsoft/eccodes/2.8.0/lib -Wl,-rpath=/global/AWIsoft/udunits/2.2.26/lib -Wl,-rpath=/global/AWIsoft/netcdf/4.6.1_gnu/lib -Wl,-rpath=HDF5DIR/lib -Wl,-rpath -Wl,/global/AWIsoft/grib_api/1.28.0/lib -Wl,-rpath -Wl,/global/AWIsoft/proj/5.1.0/lib -Wl,-rpath=/global/AWIsoft/eccodes/2.8.0/lib -Wl,-rpath=/global/AWIsoft/udunits/2.2.26/lib -Wl,-rpath=/global/AWIsoft/netcdf/4.6.1_gnu/lib -Wl,-rpath=HDF5DIR/lib -Wl,-rpath -Wl,/global/AWIsoft/grib_api/1.28.0/lib -Wl,-rpath -Wl,/global/AWIsoft/proj/5.1.0/lib -o .libs/CdiInfo CdiInfo.o -L/global/AWIsoft/netcdf/4.6.1_gnu/lib -L/global/AWIsoft/hdf5/1.10.2_gnu/lib -L/global/AWIsoft/grib_api/1.28.0/lib -L/global/AWIsoft/eccodes/2.8.0/lib ./.libs/libcdipp.a /global/AWIbuild/cdo/cdo-1.9.6/libcdi/src/.libs/libcdi.so -leccodes /global/AWIsoft/netcdf/4.6.1_gnu/lib/libnetcdf.so /global/AWIsoft/hdf5/1.10.2_gnu/lib/libhdf5_hl.so /global/AWIsoft/hdf5/1.10.2_gnu/lib/libhdf5.so -ldl -lz -lcurl -lm -luuid -pthread -Wl,-rpath -Wl,/global/AWIsoft/cdo/1.9.6/lib -Wl,-rpath -Wl,/global/AWIsoft/netcdf/4.6.1_gnu/lib -Wl,-rpath -Wl,/global/AWIsoft/hdf5/1.10.2_gnu/lib
/global/AWIbuild/cdo/cdo-1.9.6/libcdi/src/.libs/libcdi.so: undefined reference to `strIsEqual'
collect2: error: ld returned 1 exit status
make2: * [CdiInfo] Error 1
make2: Leaving directory `/global/AWIbuild/cdo/cdo-1.9.6/libcdi/interfaces'
make1:
[all-recursive] Error 1
make1: Leaving directory `/global/AWIbuild/cdo/cdo-1.9.6/libcdi'
make: *
* [all-recursive] Error 1

If I compare to cdo-1.9.5, strIsEqual is new in 1.9.6. It appears quite often in libcdi/src/cdilib.c and libcdi/src/stream_cdf_i.c. At the first glance, I cannot spot any obvious bug, but, well, my knowledge of C is limited. Time to hand it over to the experts!

Shall I attach config.log and the output of make?


Replies (5)

RE: installation problem: compiling cdo 1.9.6 with --enable-cdi-lib fails - Added by Uwe Schulzweida about 5 years ago

Unfortunately the declaration of strIsEqual() is not 100% correct. This function will be inline expanded only if the compiler optimization (-O) is enabled. Otherwise the keyword static is necessary:

static inline bool
strIsEqual(const char *x, const char *y) 

RE: installation problem: compiling cdo 1.9.6 with --enable-cdi-lib fails - Added by Natalja Rakowsky about 5 years ago

Thank you for the very fast reply! Adding optimization is generally a good idea, why did I miss that at all?! Thanks to this minor strIsEqual-bug, we get faster cdo in 1.9.6 and all following releases!

RE: installation problem: compiling cdo 1.9.6 with --enable-cdi-lib fails - Added by Matt Thompson about 5 years ago

Uwe,

I believe I just hit this issue or something similar:

../src/.libs/libcdi.a(stream_cdf_i.o): In function `cdf_time_dimid':
stream_cdf_i.c:(.text+0x12ff): undefined reference to `strIsEqual'
stream_cdf_i.c:(.text+0x1319): undefined reference to `strIsEqual'
../src/.libs/libcdi.a(stream_cdf_i.o): In function `scan_hybrid_formulaterms':
stream_cdf_i.c:(.text+0x215a): undefined reference to `strIsEqual'
stream_cdf_i.c:(.text+0x2185): undefined reference to `strIsEqual'
stream_cdf_i.c:(.text+0x21b0): undefined reference to `strIsEqual'
../src/.libs/libcdi.a(stream_cdf_i.o):stream_cdf_i.c:(.text+0x21db): more undefined references to `strIsEqual' follow
collect2: error: ld returned 1 exit status

What is the preferred fix? Should I edit files in my cdo source tree?

Thanks,
Matt

RE: installation problem: compiling cdo 1.9.6 with --enable-cdi-lib fails - Added by Uwe Schulzweida about 5 years ago

You can fix this problem by editing the file libcdi/src/cdi_int.h line 44, and change

inline bool
strIsEqual(const char *x, const char *y) 
to
static inline bool
strIsEqual(const char *x, const char *y) 
Another solution is to use the compiler flag -O to enable the optimization, but this is normally the default. Here is an example for the GNU C compiler:
./configure ...  CC=gcc CFLAGS="-g -O2" CXX=g++ CXXFLAGS="-g -O2" 

RE: installation problem: compiling cdo 1.9.6 with --enable-cdi-lib fails - Added by Matt Thompson about 5 years ago

Uwe,

Okay. I'll see about altering the source. I suppose it'll be fixed in 1.9.7, so it's temporary for now.

Thanks,
Matt

    (1-5/5)