Closed kloczek closed 2 years ago
Looks like it was just that one include and the library is otherwise not used directly. But it's an indirect dependency (through at least glib2), so I'm not sure how you're building librepo without it...
Tested and all is correct now with that commit and there is no need of the zlib in build env. I've checked as well latest glib and looks like it has no direct or indirect zlib dependencies
[tkloczko@devel-g2v include]$ grep -r zlib
glib-2.0/gio/gio.h:#include <gio/gzlibcompressor.h>
glib-2.0/gio/gio.h:#include <gio/gzlibdecompressor.h>
glib-2.0/gio/gioenums.h: * @G_ZLIB_COMPRESSOR_FORMAT_ZLIB: deflate compression with zlib header
glib-2.0/gio/gioenumtypes.h:GLIB_AVAILABLE_IN_ALL GType g_zlib_compressor_format_get_type (void) G_GNUC_CONST;
glib-2.0/gio/gioenumtypes.h:#define G_TYPE_ZLIB_COMPRESSOR_FORMAT (g_zlib_compressor_format_get_type ())
glib-2.0/gio/gzlibcompressor.h:#define G_TYPE_ZLIB_COMPRESSOR (g_zlib_compressor_get_type ())
glib-2.0/gio/gzlibcompressor.h:GType g_zlib_compressor_get_type (void) G_GNUC_CONST;
glib-2.0/gio/gzlibcompressor.h:GZlibCompressor *g_zlib_compressor_new (GZlibCompressorFormat format,
glib-2.0/gio/gzlibcompressor.h:GFileInfo *g_zlib_compressor_get_file_info (GZlibCompressor *compressor);
glib-2.0/gio/gzlibcompressor.h:void g_zlib_compressor_set_file_info (GZlibCompressor *compressor,
glib-2.0/gio/gzlibdecompressor.h:#define G_TYPE_ZLIB_DECOMPRESSOR (g_zlib_decompressor_get_type ())
glib-2.0/gio/gzlibdecompressor.h:GType g_zlib_decompressor_get_type (void) G_GNUC_CONST;
glib-2.0/gio/gzlibdecompressor.h:GZlibDecompressor *g_zlib_decompressor_new (GZlibCompressorFormat format);
glib-2.0/gio/gzlibdecompressor.h:GFileInfo *g_zlib_decompressor_get_file_info (GZlibDecompressor *decompressor);
[tkloczko@devel-g2v Packages]$ rpm -qp --qf "[%{REQUIRENAME} %{REQUIREFLAGS:depflags} %{REQUIREVERSION}\n]" glib2-devel-2.72.1-2.fc35.x86_64.rpm
/usr/bin/python3
/usr/bin/sh
glib2(x86-64) = 2.72.1-2.fc35
libc.so.6()(64bit)
libc.so.6(GLIBC_2.14)(64bit)
libc.so.6(GLIBC_2.2.5)(64bit)
libc.so.6(GLIBC_2.28)(64bit)
libc.so.6(GLIBC_2.34)(64bit)
libc.so.6(GLIBC_2.4)(64bit)
libelf.so.1()(64bit)
libelf.so.1(ELFUTILS_1.0)(64bit)
libelf.so.1(ELFUTILS_1.5)(64bit)
libgio-2.0.so.0()(64bit)
libglib-2.0.so.0()(64bit)
libgmodule-2.0.so.0()(64bit)
libgobject-2.0.so.0()(64bit)
libgthread-2.0.so.0()(64bit)
pkgconfig(gio-2.0)
pkgconfig(glib-2.0)
pkgconfig(gmodule-no-export-2.0)
pkgconfig(gobject-2.0)
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(PayloadIsZstd) <= 5.4.18-1
rtld(GNU_HASH)
Well the rpm has a dependency via a pkgconfig provide on f36:
$ dnf rq --requires glib2-devel-0:2.72.1-1.fc36.x86_64 | grep zlib
Last metadata expiration check: 0:31:06 ago on Thu May 12 12:21:24 2022.
pkgconfig(zlib)
But I didn't dig further... Not sure why your package doesn't list it.
But I didn't dig further... Not sure why your package doesn't list it.
It is lot listing because glib2 header fils are not using zlib.
[tkloczko@devel-g2v SPECS]$ rpm -ql glib2-devel | grep include.*.h$ | xargs grep zlib
/usr/include/glib-2.0/gio/gio.h:#include <gio/gzlibcompressor.h>
/usr/include/glib-2.0/gio/gio.h:#include <gio/gzlibdecompressor.h>
/usr/include/glib-2.0/gio/gioenums.h: * @G_ZLIB_COMPRESSOR_FORMAT_ZLIB: deflate compression with zlib header
/usr/include/glib-2.0/gio/gioenumtypes.h:GLIB_AVAILABLE_IN_ALL GType g_zlib_compressor_format_get_type (void) G_GNUC_CONST;
/usr/include/glib-2.0/gio/gioenumtypes.h:#define G_TYPE_ZLIB_COMPRESSOR_FORMAT (g_zlib_compressor_format_get_type ())
/usr/include/glib-2.0/gio/gzlibcompressor.h:#define G_TYPE_ZLIB_COMPRESSOR (g_zlib_compressor_get_type ())
/usr/include/glib-2.0/gio/gzlibcompressor.h:GType g_zlib_compressor_get_type (void) G_GNUC_CONST;
/usr/include/glib-2.0/gio/gzlibcompressor.h:GZlibCompressor *g_zlib_compressor_new (GZlibCompressorFormat format,
/usr/include/glib-2.0/gio/gzlibcompressor.h:GFileInfo *g_zlib_compressor_get_file_info (GZlibCompressor *compressor);
/usr/include/glib-2.0/gio/gzlibcompressor.h:void g_zlib_compressor_set_file_info (GZlibCompressor *compressor,
/usr/include/glib-2.0/gio/gzlibdecompressor.h:#define G_TYPE_ZLIB_DECOMPRESSOR (g_zlib_decompressor_get_type ())
/usr/include/glib-2.0/gio/gzlibdecompressor.h:GType g_zlib_decompressor_get_type (void) G_GNUC_CONST;
/usr/include/glib-2.0/gio/gzlibdecompressor.h:GZlibDecompressor *g_zlib_decompressor_new (GZlibCompressorFormat format);
/usr/include/glib-2.0/gio/gzlibdecompressor.h:GFileInfo *g_zlib_decompressor_get_file_info (GZlibDecompressor *decompressor);
As you see none of the glib header files are using <zlib.h>
.
That is kind of bug in all Linux distributions rpm dependencies generators are treating Requires.pivate
as actual dependencies. That is wrong. pkgconfig Requires.private
and Libs.pvivate
are only for static linking.
From https://people.freedesktop.org/~dbn/pkg-config-guide.html
Since pkg-config always exposes the link flags of the Requires libraries, these modules will become direct dependencies of the program. On the other hand, libraries from Requires.private will only be included when static linking. For this reason, it is usually only appropriate to add modules from the same package in Requires.
As I'm removing in all .pc files Requires.private
and Libs.pvivate
because I'm not providing any static libtraries I'm instantly exposing those overdependencies.
Meson dependency()
, cmake pind_package()
and aclocal PKG_CHECK_MODULE()
are querying pkg-config --libs <foo>
.
In this case issue is that that if project A
is using API of the library described in libX.pc build framework should explicit check in meson/cmake/autoconf availability odf the libX instead relaing on indirect dependencies of other necessary components.
There is no to many packages affercted by still using indirect pkgconfig dependencies and about the same number of packages hich are affected by fact that on building usiually rpm package some Requires.private
will be present in buld env because default rpm dependency generator has this overdependency issue.
To fix that instead using --print-requires --print-requires-private
should be used only --print-requires
. Alternative is to consquently remove everywhere Requires.private
if static libraries are not provided.
Nevertheless in this case librepo is not using zlib so it was possible to fix that by remove bogus #include line 😋
Looks like in cmake files it is missinng libz detection