Skip to content

Fix libsystemd auto-detection #774

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fix libsystemd auto-detection #774

wants to merge 1 commit into from

Conversation

cwendling
Copy link
Member

Properly handle missing libsystemd when enable-systemd=auto, which is even the default for this switch.

Without this, one had to explicitly give --disable-systemd despite the what the help text stated.


The reason is that PKG_CHECK_MODULES() errors-out if it is not given a 4th argument (action-is-not-found). The ideal solution for this is however to call with the right arguments depending on whether we want a hard or soft failure, because in case of hard failure PKG_CHECK_MODULES() gives a more useful error message than what we would do ourselves.

Properly handle missing libsystemd when enable-systemd=auto, which is
even the default for this switch.

Without this, one had to explicitly give `--disable-systemd` despite
the what the help text stated.
Copy link
Member

@lukefromdc lukefromdc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An autotools test build on a systemd setup successfuly detected the presence of systemd, I don't have any non-systemd systems to test the absence of it on though,

Works for the systemd present case

@lukefromdc
Copy link
Member

@cwendling , I am fine with merging this if you had a succesful autotools build (we also have meson support) on a machine without systemd. Also OK with waiting for another review if you prefer. Please advise

@lukefromdc lukefromdc requested a review from a team March 31, 2025 05:37
@cwendling
Copy link
Member Author

@lukefromdc thanks for the test. Though, if you want to test the non-systemd state, you simply need to remove the systemd development files, not systemd itself. IIRC on Debian & Ubuntu it's the libsystemd-dev package, no idea on Fedora but maybe systemd-devel or so -- but you'd probably know.

@lukefromdc
Copy link
Member

lukefromdc commented Apr 1, 2025

removing libsystemd-dev did NOT work, I got

Package 'libsystemd', required by 'dbus-1', not found
Package 'libsystemd', required by 'dbus-1', not found
Package 'libsystemd', required by 'dbus-1', not found
Package 'libsystemd', required by 'dbus-1', not found

Cannot remove anything else for this test, remember this is a live system not a VM. I do not know if this means this doesn't work on a system with dbus and systemd with systemd not detected, or if this means it doesn't work on non-systemd distros. Testing other distros is not something I can do: no landline to download them over.

@lukefromdc lukefromdc self-requested a review April 2, 2025 00:01
Copy link
Member

@lukefromdc lukefromdc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turning my approval to a comment due to the failed build with libsystemd-dev removed

@cwendling
Copy link
Member Author

cwendling commented Apr 2, 2025

@lukefromdc What is the distro you used? On my Debian Bookworm it clearly works: with libsystemd-dev, it works OK without this patch, but if I remove it, master gives me:

$ ./configure
[…]
checking for libsystemd... no
checking for libsystemd >= 248... no
configure: error: Package requirements (libsystemd >= 248) were not met:

Package 'libsystemd', required by 'virtual:world', not found
[…]

while with this patch I get:

$ ./configure
[…]
checking for libsystemd >= 248... no
[…]
Configure summary:

        mate-control-center 1.29.0
        ==========================
[…]
	Systemd:                           no
[…]

@lukefromdc
Copy link
Member

lukefromdc commented Apr 3, 2025 via email

@cwendling
Copy link
Member Author

Hum… can you tell what depends on dbus-1? I can't seem to find a reference to it in the build system, and if I check the pkg-config result for dbus-1 I don't see any reference to libsystemd -- and if there is one in a newer version, it should have the associated dependency, if not that's a packaging issue.

This said, what I tried to fix was the explicit and optional dependency on libsystemd we have, that could be disabled before my patch by explicitly asking for it. If there's indirect dependencies on it (e.g. through the dbus-1 pkg-config file), it's outside the scope of this PR, and I'm not interested in fighting those :)

@lukefromdc
Copy link
Member

I don't really have an easy way to figure that out. I am basically not in position to provide effective support for the non-systemd case and I don't want to make changes to a running system that would prevent restarting if I get a crash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants