CMake & zlib: ZLib not found

If none of the more specific forums is the right place to ask

CMake & zlib: ZLib not found

Postby Escain » 2017-09-15 12:18

Hello :-)

Introduction:

I am having issue building a project with ZLib, it seem CMake does not detect properly the binaries path for the library.
Running CMake, it indicate:

Code: Select all
 Relevant CMake configuration variables:

    ZLIB_INCLUDE_DIR=/usr/include
    ZLIB_LIBRARY=<not found>

  You may use CMake GUI, cmake -D or ccmake to modify the values.  Delete
  CMakeCache.txt to discard all values and force full re-detection if
  necessary.

Call Stack (most recent call first):
  cmake/FindZlib.cmake:34 (libfind_process)
  CMakeLists.txt:37 (find_package)


Research:

Trying to solve the issue by myself:
- Setting ZLIB_LIBRARY="/lib/x84_64-linux-gnu/"
- Setting ZLIB_ROOT="/lib/x84_64-linux-gnu/"
- Installing zlib1g and zlib1g:i386 to ensure is not an architecture issue.
- Reading and searching on internet, without relevant results.
- Searching for the libs, the zlib1g package from apper provides "/lib/x84_64-linux-gnu"
- Searching for libs with: find / -readable -name "*libz*so*" 2>/dev/null
Code: Select all
/usr/lib/x86_64-linux-gnu/libzvbi-chains.so.0.0.0
/usr/lib/x86_64-linux-gnu/libzvbi.so.0.13.2
/usr/lib/x86_64-linux-gnu/libzvbi-chains.so.0
/usr/lib/x86_64-linux-gnu/libzvbi.so.0 
/usr/lib/x86_64-linux-gnu/vlc/plugins/access/libzip_plugin.so 
/usr/lib/x86_64-linux-gnu/libzip.so.4.0.0   
/usr/lib/x86_64-linux-gnu/libzip.so.4     
/usr/lib/x86_64-linux-gnu/libzmq.so.5.1.1       
/usr/lib/x86_64-linux-gnu/libzmq.so.5   
/usr/lib/x86_64-linux-gnu/libzstd.so.1.1.2   
/usr/lib/x86_64-linux-gnu/libzstd.so.1     
/usr/lib/x86_64-linux-gnu/libz.so 
/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/libzip.so 
/lib/x86_64-linux-gnu/libz.so.1.2.8   
/lib/x86_64-linux-gnu/libz.so.1 
/lib/i386-linux-gnu/libz.so.1.2.8
/lib/i386-linux-gnu/libz.so.1


Further data:

I am using Debian stretch stable, recently installed with nothing really special: Linux host-name 4.9.0-3-amd64 #1 SMP Debian 4.9.30-2+deb9u3 (2017-08-06) x86_64 GNU/Linux

I would appreciate help for this.
Thanks in advance.
Escain
 
Posts: 7
Joined: 2016-10-02 15:17

Re: CMake & zlib: ZLib not found

Postby Segfault » 2017-09-15 13:50

It is looking for zlib header in /usr/include.
Segfault
 
Posts: 480
Joined: 2005-09-24 12:24

Re: CMake & zlib: ZLib not found

Postby Escain » 2017-09-15 15:26

I understand what you say, and agree. But you probably implicitly point to something that I miss: How is that going to help for the binaries?
Escain
 
Posts: 7
Joined: 2016-10-02 15:17

Re: CMake & zlib: ZLib not found

Postby Segfault » 2017-09-15 16:09

Well, you are compiling your project, right? And it needs zlib, right? So you need to provide zlib header file, for this you need to install zlib dev package.
Segfault
 
Posts: 480
Joined: 2005-09-24 12:24

Re: CMake & zlib: ZLib not found

Postby Escain » 2017-09-15 16:28

I suspect I already did installed 64 and 32 bit of the zlib:

Packages:
Code: Select all
 - zlib1g-dev
 - zlib1g-dev:i386
 - zlib1g
 - zlib1g:i386
....


To me, it clearly seem CMAKE found the header, and just miss the binaries. (refer to the cmake output)

I may also find the static zlib binary:

Code: Select all
/usr/lib/x86_64-linux-gnu/libz.a
Last edited by Escain on 2017-09-15 19:59, edited 1 time in total.
Escain
 
Posts: 7
Joined: 2016-10-02 15:17

Re: CMake & zlib: ZLib not found

Postby Segfault » 2017-09-15 16:29

Code: Select all
ls /usr/include/zlib.h


Is it present? Otherwise refer to configure log, do not rely on terminal output.
Segfault
 
Posts: 480
Joined: 2005-09-24 12:24

Re: CMake & zlib: ZLib not found

Postby Escain » 2017-09-15 16:42

Yes, sure, it is present. :wink:
Just to complete, what I already explained, it miss the binaries, not the headers.
Escain
 
Posts: 7
Joined: 2016-10-02 15:17

Re: CMake & zlib: ZLib not found

Postby stevepusser » 2017-09-15 22:20

No, you have not installed the header package. Like most distros, Debian splits these into a separate package from the runtime libraries, since most users don't ever need the headers. This is Debian policy for packaging any library. The Cmake error indicates missing headers, not runtime binaries. Believe me, I've seen this a lot.

You need zlib1g-dev.

[surly_teenager] Gah! [/surly_teenager]
The MX Linux repositories: Backports galore! If we don't have something, just ask and we'll try--we like challenges. New packages: AzPainter 2.1.0, Pale Moon 27.5.0, Liquorix kernel 4.12-10, mpv 0.27.0, Kodi 17.3, 0ad 0.0.22, Mesa 13.0.6
User avatar
stevepusser
 
Posts: 8802
Joined: 2009-10-06 05:53

Re: CMake & zlib: ZLib not found

Postby Escain » 2017-09-16 07:56

8 Post to say I have installed already zlib1g-dev....

CMake find and display the header directory (/usr/include/). What it does not find is the binary (<not found>).

Because trust me when I say: I already did it:
Code: Select all
root@host: apt-get install zlib1g-dev
root@host: apt-get install zlib1g-dev:i386

And trust me also when I say it tell me:
Code: Select all
zlib1g-dev is already the newest version (1:1.2.8.dfsg-5).

And that
Code: Select all
ls /usr/include/zlib.h #return "/usr/include/zlib.h"

And that opening the file, I can see:
Code: Select all
zlib.h, .... version 1.2.8.

And the fact that after CMAKE:
Code: Select all
echo $ZLIB_ INCLUDE_DIR #return /usr/include


But supposing you are right and I am wrong, which is a possibility (actually not):
How do I install zlib1g-dev?

Code: Select all
while ( true){
    answer("With apt-get install zlib1g-dev");
    replay("But I did it already, look and read again my posts");
    answer("But zlib1g-dev is missing");
    replay("No, its not, but in case, so how do I install it?");
    if (end_of_universe_arrived()) break;
}


So... For further answer, I will kindly request you having read/undrstood what is an assertion https://en.wikipedia.org/wiki/Logical_assertion and accept that "zlib1g and zlib1g-dev in both 64 and 32bit is already installed" as an assertion.
Escain
 
Posts: 7
Joined: 2016-10-02 15:17

Re: CMake & zlib: ZLib not found

Postby stevepusser » 2017-09-17 00:03

OK, just wish you had mentioned that you had installed both from the beginning. Is this software that you are trying to compile open source so that others can try to replicate the problem? It sounds like it might be a bug in the Cmake build system for the program, if what you say happens to you happens to everyone.
The MX Linux repositories: Backports galore! If we don't have something, just ask and we'll try--we like challenges. New packages: AzPainter 2.1.0, Pale Moon 27.5.0, Liquorix kernel 4.12-10, mpv 0.27.0, Kodi 17.3, 0ad 0.0.22, Mesa 13.0.6
User avatar
stevepusser
 
Posts: 8802
Joined: 2009-10-06 05:53


Return to General Questions

Who is online

Users browsing this forum: No registered users and 5 guests

fashionable