简体   繁体   中英

pkg-config couldn't find header of zlib

I have zlib and pkg-config installed and pkg-config could find zlib:

$ pkg-config --list-all | grep zlib
zlib                      zlib - zlib compression library

pkg-config --libs is working:

$ pkg-config --libs zlib
-lz  

but pkg-config --cflags couldn't find header files of zlib:

$ pkg-config --cflags zlib

prints nothing

$ cat /usr/lib64/pkgconfig/zlib.pc
prefix=/usr
exec_prefix=${prefix}
libdir=/usr/lib64
sharedlibdir=${libdir}
includedir=/usr/include

Name: zlib
Description: zlib compression library
Version: 1.2.7

Requires:
Libs: -L${libdir} -L${sharedlibdir} -lz
Cflags: -I${includedir}

Why pkg-config couldn't find zlib? (I'm using CentOS 7 if it matters)

pkg-config did find the cflags for zlib.

However, /usr/include is one of the default include paths searched by the compiler. Therefore pkg-config filters it from the output, so that the compiler won't search it twice.

For the same reason --libs produced only -lz , not including the library path -L/usr/lib64 which is also a default.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM