Can't find ZLIB (missing: ZLIB_LIBRARY) Ubuntu 20 CMake

I am compiling github’s OpenROAD.
Following the instructions.

  1. github clone
  2. cd OpenROAD
  3. mkdir build, and cmake …

The cmake checks, proceeds and stops, with an error
‘Could NOT find ZLIB’

I have issued the command, within Ubuntu version 20:
export ZLIB_LIBRARY=/usr/local/zlib/lib
export ZLIB_INCLUDE_DIR=/urs/local/zlib/include

But still receive a not found a error. Someone
said on the internet, there is a fundamental error within
CMake, with regard to ZLIB. Could someone suggest a
solution to this problem? The ZLIB software is
installed.

from CMake:
– Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
– Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)

This directory: /usr/local/Zlib is not the one of default system to install software. The usual would be to Zlib to install on /usr/local/lib, /usr/local/include, /usr/local/share, etc. During its installation it seems it was executed ./configure --prefix=/usr/local/zlib that was used to create this dir and then install zlib components on it.

So cmake doesn’t know that it exists. I enterthe build dir and then execute: CMAKE_PREFIX_PATH=/usr/local/zlib cmake . too see if its detected then.

P.S: I used this to detect libraries, but your problem seems related to header files detection, so take it with a grain of salt. If it does not work, you could create symbolic links from zlib/include to /usr/local/include

These are environment variables. Find modules sometimes, but rarely, use these. You need to pass them as CMake variables. For example:

cmake -DZLIB_LIBRARY=/usr/local/zlib/lib/libz.so -DZLIB_INCLUDE_DIR=/usr/local/zlib/include $builddir
1 Like