cannot find -lz


I have installed zlib from source code (install path is /usr/local/zlib), and I have also installed HDF5 with zlib using the following command:
CC=/opt/intel/compilers_and_libraries_2020.4.304/linux/bin/intel64/icc CXX=/opt/intel/compilers_and_libraries_2020.4.304/linux/bin/intel64/icpc FC=/opt/intel/compilers_and_libraries_2020.4.304/linux/bin/intel64/ifort CPPFLAGS=-I/usr/local/ufs-develop/zlib/include LDFLAGS=-L/usr/local/ufs-develop/zlib/lib ./configure --prefix=/usr/local/ufs-develop/hdf5 --with-zlib=/usr/local/ufs-develop/zlib --with-szlib=/usr/local/ufs-develop/szip --enable-hl --enable-fortran --enable-cxx

However, when I installed WRF or RTTOV application, there is an error, i.e.,
cd …/…/tmp-ifort/test && ifort -o …/…/.//bin/example_aer_file_fwd.exe …/…/.//obj/example_aer_file_fwd.o -L…/…/.//lib -lrttov12_test -lrttov12_other -lrttov12_brdf_atlas -lrttov12_emis_atlas -lrttov12_mw_scatt -lrttov12_coef_io -lrttov12_hdf -lrttov12_parallel -lrttov12_main -L/usr/local/ufs-develop/netcdf/lib -lnetcdff -L/usr/local/ufs-develop/hdf5/lib -lhdf5hl_fortran -lhdf5_hl -lhdf5_fortran -lhdf5 -lz
ld: cannot find -lz

In the ZLIB install path, libz.a,, and have been successfully installed. I am confused that why the zlib library is not be found, and how can I fix it? (System: Ubuntu 20.04.1)

PS: I have successfully installed WRF and RTTOV applications on Ubuntu 18.04. But fails on Ubuntu 20.04.1.



If you put a minimum working example with a makefile, i wil get back to you with the solution. It should work, i regularly test against icc and hdf5 on ubuntu 20.04 and spack.

Thank you for your reply.

Yesterday, I have tried to added “-L/usr/local/ufs-develop/zlib/lib -lhdf5_hl -lhdf5 -lz” in the RTTOV’s Makefile following “-L/usr/local/ufs-develop/hdf5/lib -lhdf5hl_fortran -lhdf5_hl -lhdf5_fortran -lhdf5 -lz”, that is,
LDFLAGS_HDF5 = -L$(HDF5_PREFIX)/lib -lhdf5hl_fortran -lhdf5_hl -lhdf5_fortran -lhdf5 -lz
-L/usr/local/ufs-develop/zlib/lib -lhdf5_hl -lhdf5 -lz

And it solved the problem. I want to know that why I can install RTTOV in Ubuntu 18.04 but failed in Ubuntu 20.04. Is this system problem or hdf5 itself?

Thanks again.