Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

CMake & zlib: ZLib not found

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
Escain
Posts: 17
Joined: 2016-10-02 15:17

CMake & zlib: ZLib not found

#1 Post by Escain »

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.

Segfault
Posts: 993
Joined: 2005-09-24 12:24
Has thanked: 5 times
Been thanked: 17 times

Re: CMake & zlib: ZLib not found

#2 Post by Segfault »

It is looking for zlib header in /usr/include.

Escain
Posts: 17
Joined: 2016-10-02 15:17

Re: CMake & zlib: ZLib not found

#3 Post by Escain »

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?

Segfault
Posts: 993
Joined: 2005-09-24 12:24
Has thanked: 5 times
Been thanked: 17 times

Re: CMake & zlib: ZLib not found

#4 Post by Segfault »

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.

Escain
Posts: 17
Joined: 2016-10-02 15:17

Re: CMake & zlib: ZLib not found

#5 Post by Escain »

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.

Segfault
Posts: 993
Joined: 2005-09-24 12:24
Has thanked: 5 times
Been thanked: 17 times

Re: CMake & zlib: ZLib not found

#6 Post by Segfault »

Code: Select all

ls /usr/include/zlib.h
Is it present? Otherwise refer to configure log, do not rely on terminal output.

Escain
Posts: 17
Joined: 2016-10-02 15:17

Re: CMake & zlib: ZLib not found

#7 Post by Escain »

Yes, sure, it is present. :wink:
Just to complete, what I already explained, it miss the binaries, not the headers.

User avatar
stevepusser
Posts: 12930
Joined: 2009-10-06 05:53
Has thanked: 41 times
Been thanked: 72 times

Re: CMake & zlib: ZLib not found

#8 Post by stevepusser »

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]
MX Linux packager and developer

Escain
Posts: 17
Joined: 2016-10-02 15:17

Re: CMake & zlib: ZLib not found

#9 Post by Escain »

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.

User avatar
stevepusser
Posts: 12930
Joined: 2009-10-06 05:53
Has thanked: 41 times
Been thanked: 72 times

Re: CMake & zlib: ZLib not found

#10 Post by stevepusser »

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.
MX Linux packager and developer

Post Reply