Message ID | 20240912162232.1588976-1-sairon@sairon.cz |
---|---|
State | Changes Requested |
Headers | show |
Series | [1/1] package/procps-ng: fix build with BR2_PACKAGE_SYSTEMD enabled | expand |
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
Jan, All, On 2024-09-12 19:33 +0200, Yann E. MORIN spake thusly: > 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 [--SNIP--] > > ifeq ($(BR2_PACKAGE_SYSTEMD),y) > > PROCPS_NG_DEPENDENCIES += systemd > > PROCPS_NG_CONF_OPTS += --with-systemd > > +PROCPS_NG_LIBS += -lsystemd [--SNIP--] > In other words, there is an issue that must be fixed in the package, not > in Buildroot. And it seems upstream has already noticed, and we have a patch to backport: https://gitlab.com/procps-ng/procps/-/commit/ca004d4657d5e8b468a4552ede429be53193a3a9 (incidentally, it's the first commit right after the 4.0.4 release... At least, there will be no conflict! :-] ) Regards, Yann E. MORIN.
Hi Yann, everyone, thanks for looking into that and sorry for my late reply. I was about to send a backport of the patch now but I see Hugo Cornelis was faster with the correct fix and you already committed it to master a few hours ago, so thank you both! Cheers, Jan On Thu, 12 Sept 2024 at 19:44, Yann E. MORIN <yann.morin.1998@free.fr> wrote: > > Jan, All, > > On 2024-09-12 19:33 +0200, Yann E. MORIN spake thusly: > > 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 > [--SNIP--] > > > ifeq ($(BR2_PACKAGE_SYSTEMD),y) > > > PROCPS_NG_DEPENDENCIES += systemd > > > PROCPS_NG_CONF_OPTS += --with-systemd > > > +PROCPS_NG_LIBS += -lsystemd > [--SNIP--] > > In other words, there is an issue that must be fixed in the package, not > > in Buildroot. > > And it seems upstream has already noticed, and we have a patch to > backport: > > https://gitlab.com/procps-ng/procps/-/commit/ca004d4657d5e8b468a4552ede429be53193a3a9 > > (incidentally, it's the first commit right after the 4.0.4 release... At > least, there will be no conflict! :-] ) > > Regards, > Yann E. MORIN. > > -- > .-----------------.--------------------.------------------.--------------------. > | 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. | > '------------------------------^-------^------------------^--------------------'
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 else PROCPS_NG_CONF_OPTS += --without-systemd endif
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(-)