Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.28.0: autoconf pkgconfig dependencies uses indirect dependencies #313

Open
kloczek opened this issue Feb 24, 2024 · 8 comments
Open

1.28.0: autoconf pkgconfig dependencies uses indirect dependencies #313

kloczek opened this issue Feb 24, 2024 · 8 comments
Labels
template ignored! Basic informations are missing

Comments

@kloczek
Copy link

kloczek commented Feb 24, 2024

Looks like mate-session-manager uses gio-unix-2.0 because

build fails with
[tkloczko@pers-jacek mate-session-manager-1.28.0]$ make -k
make  all-recursive
make[1]: Entering directory '/home/tkloczko/rpmbuild/BUILD/mate-session-manager-1.28.0'
Making all in po
make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/mate-session-manager-1.28.0/po'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/mate-session-manager-1.28.0/po'
Making all in mate-submodules
make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/mate-session-manager-1.28.0/mate-submodules'
Making all in libegg
make[3]: Entering directory '/home/tkloczko/rpmbuild/BUILD/mate-session-manager-1.28.0/mate-submodules/libegg'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/mate-session-manager-1.28.0/mate-submodules/libegg'
make[3]: Entering directory '/home/tkloczko/rpmbuild/BUILD/mate-session-manager-1.28.0/mate-submodules'
make[3]: Nothing to be done for 'all-am'.
make[3]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/mate-session-manager-1.28.0/mate-submodules'
make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/mate-session-manager-1.28.0/mate-submodules'
Making all in mate-session
make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/mate-session-manager-1.28.0/mate-session'
make  all-am
make[3]: Entering directory '/home/tkloczko/rpmbuild/BUILD/mate-session-manager-1.28.0/mate-session'
make[3]: Nothing to be done for 'all-am'.
make[3]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/mate-session-manager-1.28.0/mate-session'
make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/mate-session-manager-1.28.0/mate-session'
Making all in capplet
make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/mate-session-manager-1.28.0/capplet'
  CC       gsm-properties-dialog.o
In file included from gsm-properties-dialog.c:35:
msm-desktop-app-dialog.h:6:10: fatal error: gio/gdesktopappinfo.h: No such file or directory
    6 | #include <gio/gdesktopappinfo.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [Makefile:521: gsm-properties-dialog.o] Error 1
  CC       msm-desktop-app-dialog.o
In file included from msm-desktop-app-dialog.c:5:
msm-desktop-app-dialog.h:6:10: fatal error: gio/gdesktopappinfo.h: No such file or directory
    6 | #include <gio/gdesktopappinfo.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

At the same time:

[tkloczko@pers-jacek mate-session-manager-1.28.0]$ grep PKG_ configure.ac
PKG_PROG_PKG_CONFIG()
PKG_CHECK_MODULES(MATE_SESSION,
PKG_CHECK_MODULES(SESSION_PROPERTIES,
PKG_CHECK_MODULES(X11, x11)
PKG_CHECK_MODULES(SM, sm)
PKG_CHECK_MODULES(ICE, ice)
PKG_CHECK_MODULES(XEXT, xext xau)
PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= $GTK_REQUIRED)
PKG_CHECK_MODULES(GL_TEST, xcomposite gl glib-2.0 epoxy)
PKG_CHECK_MODULES(DBUS_GLIB, dbus-glib-1 >= $DBUS_GLIB_REQUIRED)
PKG_CHECK_MODULES(LIBEGG, sm ice gtk+-3.0)
    PKG_CHECK_MODULES(GLES_TEST, egl glesv2, have_glesv2=yes, have_glesv2=no)
    PKG_CHECK_MODULES(SYSTEMD, [libsystemd], [use_systemd=yes],
                      [PKG_CHECK_MODULES(SYSTEMD, [libsystemd-login],
    PKG_CHECK_MODULES(LIBELOGIND,[libelogind], [use_elogind=yes], [use_elogind=no])
PKG_CHECK_MODULES(XTEST, xtst, have_xtest=yes, have_xtest=no)
PKG_CHECK_MODULES(XRENDER, xrender, have_xrender=yes, have_xrender=no)
      [PKG_CHECK_MODULES(XTRANS, xtrans,
[tkloczko@pers-jacek mate-session-manager-1.28.0]$ grep gio-unix-2.0 configure.ac
[tkloczko@pers-jacek mate-session-manager-1.28.0]$
@kloczek
Copy link
Author

kloczek commented Feb 24, 2024

Looks like below patch fixes this issue

--- a/configure.ac
+++ b/configure.ac
@@ -55,6 +55,7 @@

 PKG_CHECK_MODULES(SESSION_PROPERTIES,
         glib-2.0 >= $GLIB_REQUIRED
+        gio-unix-2.0 >= $GLIB_REQUIRED
         gtk+-3.0 >= $GTK_REQUIRED
 )

Please let me know if you want this as PR.

@raveit65
Copy link
Member

@kloczek
Copy link
Author

kloczek commented Feb 24, 2024

Please show me your spec file. Or take a look at mine.

here it is
%global         build_cflags    %{build_cflags} -Os

Summary:        MATE Desktop session manager
Name:           mate-session-manager
Version:        1.28.0
Release:        2%{?dist}
License:        GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later.html)
URL:            https://mate-desktop.org/
VCS:            https://github.com/mate-desktop/mate-session-manager/
Source:         https://pub.mate-desktop.org/releases/%(v=%{version}; echo ${v%.*})/%{name}-%{version}.tar.xz
Patch:          %{name}-do_not_install_some_docs.patch
Patch:          %{name}-use_DocBook_4.5.patch
Patch:          %{name}-add_missing_gio-unix-2.0_depndencies.patch
BuildRequires:  autoconf-archive
BuildRequires:  automake
BuildRequires:  docbook-style-xsl
BuildRequires:  docbook-xml-dtd-4.5
BuildRequires:  gcc
BuildRequires:  gettext-devel
BuildRequires:  libtool
BuildRequires:  mate-common
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(dbus-glib-1)  >= 0.76
BuildRequires:  pkgconfig(gio-2.0)      >= 2.25.0
BuildRequires:  pkgconfig(glib-2.0)     >= 2.50.0
BuildRequires:  pkgconfig(gtk+-3.0)     >= 3.22.0
BuildRequires:  pkgconfig(ice)
BuildRequires:  pkgconfig(libsystemd)
BuildRequires:  pkgconfig(sm)
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xau)
BuildRequires:  pkgconfig(xext)
BuildRequires:  pkgconfig(xrender)
BuildRequires:  pkgconfig(xtrans)
BuildRequires:  xmlto
# CheckRequires:
BuildRequires:  pkgconfig(epoxy)
BuildRequires:  pkgconfig(gl)
BuildRequires:  pkgconfig(glesv2)
BuildRequires:  pkgconfig(xcomposite)
BuildRequires:  pkgconfig(xtst)
Requires:       dbus-x11
Requires:       mate-control-center
Requires:       mate-desktop-libs
Requires:       mate-polkit
Requires:       system-logos

%description
mate-session contains the MATE session manager, as well as a configuration
program to choose applications starting on login.

%prep
%autosetup -p1

%build
autoreconf -fiv
%configure \
        --disable-static \
        --enable-ipv6 \
        --with-default-wm=marco \
        --with-systemd \
        --enable-docbook-docs \
        --disable-schemas-compile \
        %{nil}
%make_build

%install
%make_install

%find_lang %{name}

%check
%make_build check

%files -f %{name}.lang
%doc doc/dbus/mate-session.html
%attr(755,root,root) %{_bindir}/mate-*
%{_datadir}/applications/*.desktop
%{_datadir}/glib-2.0/schemas/*.gschema.xml
%{_datadir}/icons/*/*/*/*
%{_datadir}/mate-session-manager
%{_datadir}/xsessions/mate.desktop
%{_libexecdir}/mate-session-check-*
%{_mandir}/man1/*

https://src.fedoraproject.org/rpms/mate-session-manager/blob/rawhide/f/mate-session-manager.spec I was able to build m-s-m without any problem for f40 and rawhide. https://koji.fedoraproject.org/koji/buildinfo?buildID=2408391 https://koji.fedoraproject.org/koji/buildinfo?buildID=2408388

Fedora has a lot indirect dependencies caused by well known bug in pkgconfig dependencies generator.
https://github.com/rpm-software-management/rpm/blob/master/scripts/pkgconfigdeps.sh#L42-L60

As you see it is used here $pkgconfig --print-requires --print-requires-private which is causing that to the REQUIRES are added dependencies used on 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.

This causes that if .pc file contains Requires.private: foo that foo is added to -devel REQUIRES.
At the same time PKG_CHECK_MODULES() aclocal macro executes pkgconf with only --print-requires.
I've been wrtiting about that issue MANY times in last FOUR YEARS. No one want to listen about that.

Now that issue affects even latest pkgconfig. My recent comment about that you can read about that on pkgconf/pkgconf#321

This Issue with indirect dependencies is very CLEARLY visible as mate-session-manager is using gio-unix-2.0 header files and is NOT CHECKING dependencies about that pkgconfig API (gio-unix-2.0 has in its Cflags: own base path with its headers).

@raveit65
Copy link
Member

raveit65 commented Feb 24, 2024

Weird, for me it works without adding gio-unix-2.0 >= $GLIB_REQUIRED.
No, idea, another team member should take a look at it.
Edit:
BuildRequires: dbus-glib-devel was all what i need in my spec file.

@kloczek
Copy link
Author

kloczek commented Feb 24, 2024

BuildRequires: dbus-glib-devel was all what i need in my spec file.

Which is equivalent of pkgconfig(dbus-glib-1) which actually is required in configure.ac

PKG_CHECK_MODULES(DBUS_GLIB, dbus-glib-1 >= $DBUS_GLIB_REQUIRED)

Just check in which one .pc file in build env you have gio-unix-2.0 in Requires.private:.
As I mentioned in pkgconfig ticket I have no at all any .pc files with Requires.private: because that field suppose to be used ONLY on STATIC LINKIG (and I have no any static libraries in my distro).

@raveit65
Copy link
Member

We do not use static linking in official fedora Mate. And my build works fine.
https://koji.fedoraproject.org/koji/buildinfo?buildID=2408391
https://koji.fedoraproject.org/koji/buildinfo?buildID=2408388

@kloczek
Copy link
Author

kloczek commented Feb 24, 2024

We do not use static linking in official fedora Mate. And my build works fine.

No one wrote anything which may point on something like that (and not me as well).
I've QUOTED only that all *.private: are for static linking which IPLIES that use those fields by rpm dependencies generator is WRONG and cases MANY other issues which this one is only yet-another-ripple on that buggy pond.

Did you check what you have in .pc files in mate-session-manager build env as I've asked to check that? 🤔

@raveit65
Copy link
Member

No one wrote anything which may point on something like that (and not me as well).

We reached a level which i don't like , bye!
You can check that for yourself. Download the package from koji site and open it with engrampa.

@raveit65 raveit65 added the template ignored! Basic informations are missing label Feb 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
template ignored! Basic informations are missing
Projects
None yet
Development

No branches or pull requests

2 participants