Troubleshooting
Problem
How do I recompile szip (HDF5 integration)?
Resolving The Problem
How do I recompile szip (HDF5 integration)?
szip is a library used by HDF5. You can include it or not during the configuraton step for HDF5.
Please find below the procedure to get the source code, compile it and install it :
1- get the source code :
wget ftp://ftp.hdfgroup.org/lib-external/szip/2.0/src/szip-2.0.tar.gz
2- Configure with the correct prefix:
./configure --prefix=/share/apps/szip-2.0
3- Build the library :
make
The build will be successful for the library, but the examples will fail with the following error :
-------------------------------------------------------------------------------------------
gcc -std=c99 -pedantic -Wall -W -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast -align -Wwrite-strings -Wconversion -Wsign-compare -Waggregate-return -Wstrict-prototypes -Wmissing- prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline -Wno-long-long -Wfloat- equal -Wmissing-format-attribute -Wpadded -O3 -fomit-frame-pointer -o .libs/burst_szip burst_szip.o ../test/.libs/libmcgill.a ../src/.libs/libsz.so -Wl,--rpath -Wl,/share/apps/szip-2.0/lib
burst_szip.o(.text+0x5f8): In function `random_float_scanline':
: undefined reference to `sin'
burst_szip.o(.text+0x707): In function `random_double_scanline':
: undefined reference to `sin'
burst_szip.o(.text+0xa67): In function `main':
: undefined reference to `sin'
burst_szip.o(.text+0xb28): In function `main':
: undefined reference to `pow'
burst_szip.o(.text+0xb48): In function `main':
: undefined reference to `pow'
collect2: ld returned 1 exit status
make[1]: *** [burst_szip] Error 1
make[1]: Leaving directory `/home/mehdi/compile_temp/HDF5/szip-2.0/examples'
make: *** [all-recursive] Error 1
-------------------------------------------------------------
This is because the math library is missing at link time.
One way to correct this manually is to add -lm at link time :
-------------------------------------------------------------
[mehdi@bullet szip-2.0]$ cd /home/mehdi/compile_temp/HDF5/szip-2.0/examples
[mehdi@bullet examples]$ gcc -std=c99 -pedantic -Wall -W -Wundef -Wshadow -Wpointer-arith -Wbad- function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wsign-compare -Waggregate-return - Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs - Winline -Wno-long-long -Wfloat-equal -Wmissing-format-attribute -Wpadded -O3 -fomit-frame-pointer -o .libs/burst_szip burst_szip.o ../test/.libs/libmcgill.a ../src/.libs/libsz.so -lm
-----------------------------------------------------------------------------------------
The hot fix to correct this problem is to modify the Makefle generated during configuration :
-----------------------------------------------------------------------------------------
[mehdi@bullet examples]$ diff Makefile Makefile.orig
53c53
< CFLAGS = -std=c99 -pedantic -Wall -W -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wsign-compare -Waggregate-return -Wstrict-prototypes - Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline -Wno-long-long - Wfloat-equal -Wmissing-format-attribute -Wpadded -O3 -fomit-frame-pointer -lm
---
> CFLAGS = -std=c99 -pedantic -Wall -W -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wsign-compare -Waggregate-return -Wstrict-prototypes - Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline -Wno-long-long - Wfloat-equal -Wmissing-format-attribute -Wpadded -O3 -fomit-frame-pointer
Was this topic helpful?
Document Information
Modified date:
16 September 2018
UID
isg3T1014402