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

polkit-126 fails to build with -Dsession_tracking=elogind #539

Open
Polynomial-C opened this issue Jan 14, 2025 · 2 comments
Open

polkit-126 fails to build with -Dsession_tracking=elogind #539

Polynomial-C opened this issue Jan 14, 2025 · 2 comments

Comments

@Polynomial-C
Copy link

Describe the bug
polkit-126 fails to build when using elogind as session tracker:

x86_64-pc-linux-gnu-gcc -Isrc/polkitbackend/polkitd.p -Isrc/polkitbackend -I../polkit-126/src/polkitbackend -I. -I../polkit-126 -Isrc -I../polkit-126/src -Isrc/polkit -I/usr/lib64/libffi/include -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libmount -I/usr/include/uuid -I/usr/include/json-c -I/usr/include/blkid -I/usr/include/gio-unix-2.0 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c99 -D_GNU_SOURCE -include config.h -Wno-format-y2k -Wno-declaration-after-statement -Wno-unused-result -march=native -mtune=native -O2 -pipe -pthread '-DG_LOG_DOMAIN="polkitd-1"' -DPOLKIT_BACKEND_I_KNOW_API_IS_SUBJECT_TO_CHANGE -MD -MQ src/polkitbackend/polkitd.p/polkitd.c.o -MF src/polkitbackend/polkitd.p/polkitd.c.o.d -o src/polkitbackend/polkitd.p/polkitd.c.o -c ../polkit-126/src/polkitbackend/polkitd.c
../polkit-126/src/polkitbackend/polkitd.c:34:12: fatal error: systemd/sd-daemon.h: No such file or directory
   34 | #  include <systemd/sd-daemon.h>
      |            ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
ninja: build stopped: subcommand failed.

As you can see, the compiler command lacks the important -I/usr/include/elogind and that is where systemd/sd-daemon.h can be found when elogind is being used.

To Reproduce
Steps to reproduce the behavior:

  1. Have a system with elogind as logind provider (no systemd!)
  2. Compile the project with -Dsession_tracking=elogind
  3. Wait for the above error message

Expected behavior
Build succeeds like with previous releases ;)

Desktop (please complete the following information):

  • OS (including version): Gentoo Linux
  • Version of polkit: 126

Additional context
I am not really experienced with meson build system but right now I use this workaround to make polkit-126 build succeed:

diff --git a/src/polkitbackend/meson.build b/src/polkitbackend/meson.build
index fc35e19..c4cf2db 100644
--- a/src/polkitbackend/meson.build
+++ b/src/polkitbackend/meson.build
@@ -69,11 +69,16 @@ c_flags = [
   '-DPOLKIT_BACKEND_I_KNOW_API_IS_SUBJECT_TO_CHANGE',
 ]

+polkitd_dep = [ libpolkit_gobject_dep ]
+if enable_logind and session_tracking == 'elogind'
+  polkitd_dep += logind_dep
+endif
+
 executable(
   program,
   program + '.c',
   include_directories: top_inc,
-  dependencies: libpolkit_gobject_dep,
+  dependencies: polkitd_dep,
   c_args: c_flags,
   link_with: libpolkit_backend,
   install: true,
@jrybar-rh jrybar-rh assigned bluca and unassigned bluca Jan 14, 2025
@markhindley
Copy link

I have just hit this issue as well.

The attached patch fixes it for me and cleans up a misplaced empty line.

Mark

02_fix-polkitbackend-elogind-include.patch.txt

@jrybar-rh
Copy link
Member

Will be investigated. Thanks to @Polynomial-C for reporting and @markhindley for the patch.

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

No branches or pull requests

4 participants