All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: "Jan Čermák" <sairon@sairon.cz>
Cc: buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH 1/1] package/procps-ng: fix build with BR2_PACKAGE_SYSTEMD enabled
Date: Thu, 12 Sep 2024 19:33:16 +0200	[thread overview]
Message-ID: <ZuMl3F2Wga2vO-mH@landeda> (raw)
In-Reply-To: <20240912162232.1588976-1-sairon@sairon.cz>

Jan, All,

On 2024-09-12 18:22 +0200, Jan Čermák spake thusly:
> After update to v4.0.4, props-ng build fails on linker error if
> BR2_PACKAGE_SYSTEMD is enabled:
> 
> /buildroot/output/host/lib/gcc/x86_64-buildroot-linux-gnu/13.3.0/../../../../x86_64-buildroot-linux-gnu/bin/ld: src/w.o: undefined reference to symbol 'sd_session_get_uid@@LIBSYSTEMD_209'
> /buildroot/output/host/lib/gcc/x86_64-buildroot-linux-gnu/13.3.0/../../../../x86_64-buildroot-linux-gnu/bin/ld: /buildroot/output/host/x86_64-buildroot-linux-gnu/sysroot/usr/lib64/libsystemd.so.0: error adding symbols: DSO missing from command line
> collect2: error: ld returned 1 exit status
> 
> Add lsystemd to configure arguments if systemd is enabled to fix this.
> 
> Signed-off-by: Jan Čermák <sairon@sairon.cz>
> ---
>  package/procps-ng/procps-ng.mk | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/package/procps-ng/procps-ng.mk b/package/procps-ng/procps-ng.mk
> index 2f28e3571e..cff4e21c5e 100644
> --- a/package/procps-ng/procps-ng.mk
> +++ b/package/procps-ng/procps-ng.mk
> @@ -12,11 +12,13 @@ PROCPS_NG_LICENSE_FILES = COPYING COPYING.LIB
>  PROCPS_NG_CPE_ID_VALID = YES
>  PROCPS_NG_INSTALL_STAGING = YES
>  PROCPS_NG_DEPENDENCIES = ncurses host-pkgconf $(TARGET_NLS_DEPENDENCIES)
> -PROCPS_NG_CONF_OPTS = LIBS=$(TARGET_NLS_LIBS)
> +PROCPS_NG_CONF_OPTS = LIBS="$(PROCPS_NG_LIBS)"
> +PROCPS_NG_LIBS=$(TARGET_NLS_LIBS)
>  
>  ifeq ($(BR2_PACKAGE_SYSTEMD),y)
>  PROCPS_NG_DEPENDENCIES += systemd
>  PROCPS_NG_CONF_OPTS += --with-systemd
> +PROCPS_NG_LIBS += -lsystemd

This is very weird that htis s needed, and points to an issue in the
package itself. Indeed, the code to detect systemd is as follows:

  configur.ac:
  285 AC_ARG_WITH([systemd],
  286   [AS_HELP_STRING([--with-systemd], [enable systemd support])],
  287   [], [with_systemd=no]
  288 )
  289 AS_IF([test "x$with_systemd" != "xno"], [
  290   PKG_CHECK_MODULES([SYSTEMD], [libsystemd],,
  291     [PKG_CHECK_MODULES([SYSTEMD], [libsystemd-login])]
  292   )
  293   AC_DEFINE(WITH_SYSTEMD, 1, [enable systemd support])
  294
  295   # The functions needed to replace utmp with logind are only available
  296   # with systemd v254 or later.
  297   old_LIBS="$LIBS"
  298   LIBS="$LIBS $SYSTEMD_LIBS"
  299   AC_CHECK_FUNCS([sd_session_get_leader])
  300   LIBS="$old_LIBS"
  301 ])
  302 AM_CONDITIONAL([WITH_SYSTEMD], [test x$with_systemd != xno])

Co it is searching libsystemd with pkg-config, and so this is should
set SYSTEMD_LIBS to -lsystemd and we should not have to do it ourselves.
And indeed, libsystemd.pc contains:
    Libs: -L${libdir} -lsystemd

So, the real issue is that the Makefile.am of procps-ng forgets to
declare that src/w (a program to be built) should be linked with
libsystemd:

  Makefile.am:
  143 if BUILD_W
  144 if CYGWIN
  145 usrbin_exec_PROGRAMS += src/w
  146 else
  147 bin_PROGRAMS += src/w
  148 endif
  149
  150 dist_man_MANS += man/w.1
  151 src_w_SOURCES = src/w.c local/fileutils.c
  152 else
  153   EXTRA_DIST += man/w.1
  154 endif

In other words, there is an issue that must be fixed in the package, not
in Buildroot.

Regards,
Yann E. MORIN.

>  else
>  PROCPS_NG_CONF_OPTS += --without-systemd
>  endif
> -- 
> 2.46.0
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2024-09-12 17:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-12 16:22 [Buildroot] [PATCH 1/1] package/procps-ng: fix build with BR2_PACKAGE_SYSTEMD enabled Jan Čermák
2024-09-12 17:33 ` Yann E. MORIN [this message]
2024-09-12 17:44   ` Yann E. MORIN
2024-09-14 22:16     ` Jan Čermák

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZuMl3F2Wga2vO-mH@landeda \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@buildroot.org \
    --cc=sairon@sairon.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.