hdf5 compilation error: Bad value

chawas1@nwp:~/COSMO/source/hdf5-1.10.2$ sudo make check
Making check in src
make[1]: Entering directory ‘/home/chawas1/COSMO/source/hdf5-1.10.2/src’
LD_LIBRARY_PATH="$LD_LIBRARY_PATHecho | \ sed -e 's/-L/:/g' -e 's/ //g'"
./H5make_libsettings > H5lib_settings.c ||
(test $HDF5_Make_Ignore && echo “*** Error ignored”) ||
(rm -f H5lib_settings.c ; exit 1)
CC H5lib_settings.lo
CC H5Zdeflate.lo
CCLD libhdf5.la
/usr/bin/x86_64-linux-gnu-ld: /home/chawas1/COSMO/zlib-1.2.1_build/lib/libz.a(deflate.o): relocation R_X86_64_PC32 against symbol `_length_code’ can not be used when making a shared object; recompile with -fPIC
/usr/bin/x86_64-linux-gnu-ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
Makefile:1089: recipe for target ‘libhdf5.la’ failed
make[1]: *** [libhdf5.la] Error 1
make[1]: Leaving directory ‘/home/chawas1/COSMO/source/hdf5-1.10.2/src’
Makefile:652: recipe for target ‘check-recursive’ failed
make: *** [check-recursive] Error 1
chawas1@nwp:~/COSMO/source/hdf5-1.10.2$ echo LD_LIBRARY_PATH
LD_LIBRARY_PATH
chawas1@nwp:~/COSMO/source/hdf5-1.10.2$ nano Makefile