You need to install -dev package for zlib1g - it is named zlib1g-dev:
sudo apt-get install zlib1g-dev
and it will install zlib.pc file for pkg-config along with zlib.h header.
ubuntu 18.04 - Could NOT find ZLIB (missing: ZLIB_LIBRARY) (found version "1.2.11") - Stack Overflow
[Documentation Improvement] CMake error: Could not Find ZLIB error while using make
ubuntu 14.04 - No zlib.h file in usr/local/include how to get it - Stack Overflow
zlib not found, but installed
Install zlib with development support by using
sudo apt-get install zlib1g-dev
In case you don't want or need to use the full zlib, it is fairly easy to write wrapper routines which map the zlib functions 1:1 to ordinary file functions which don't support compression and decompression.
//
// dummy zlib.h
//
#pragma once
#include <stdio.h>
typedef FILE *gzFile;
int gzclose(gzFile file);
gzFile gzdopen(int fd, const char *mode);
gzFile gzopen(const char *path, const char *mode);
int gzread(gzFile file, void *buf, unsigned int len);
//
// zlibDummy.cpp
//
#include <zlib.h>
int gzclose(gzFile file)
{
return fclose(file);
}
gzFile gzdopen(int fd, const char *mode)
{
return _fdopen(fd, mode);
}
gzFile gzopen(const char *path, const char *mode)
{
return fopen(path, mode);
}
int gzread(gzFile file, void *buf, unsigned int len)
{
return fread(buf, 1, len, file);
}
Well, temporary solution
download from : https://github.com/madler/zlib/blob/master/zlib.h
put the file in the same folder as your project file.
#include "zlib.h"
Hello,
I'm trying to make a tool, but I'm getting this error:
CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message): Could NOT find ZLIB (missing: ZLIB_LIBRARY) (found version "1.2.11")
I have installed zlib using
sudo apt install zlib1g-dev
, and zlib.h is located in /usr/include/, which was suggested in other threads with this problem, but it didn't help. What else can I do?
I've installed the same tool on another computer without problems, so it's not the tool.
You should install the development support files for zlib, try:
sudo apt-get install libz-dev
Other package names: zlib1g-dev.
If you've already zlib library, make sure you're compiling your code sources with -lz. See: missing zlib.h in ubuntu.
Install zlib from it's source, solve my similar error. Download last version from this then:
configure
make -j4
make install