* [Buildroot] [PATCH 1/1] package/systemd: link host systemd utilities statically
@ 2024-09-10 19:36 James Hilliard
2024-09-11 16:44 ` Yann E. MORIN
0 siblings, 1 reply; 4+ messages in thread
From: James Hilliard @ 2024-09-10 19:36 UTC (permalink / raw)
To: buildroot; +Cc: James Hilliard, Norbert Lange, Sen Hastings, Yann E . MORIN
This makes it less likely that we will run into missing library
errors when running host systemd utilities and lets us remove the
HOST_SYSTEMD_FIX_RPATH hack.
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
.../fakeroot_tmpfiles.sh | 2 +-
.../skeleton-init-systemd.mk | 2 +-
package/systemd/systemd.mk | 30 +++++++------------
3 files changed, 13 insertions(+), 21 deletions(-)
diff --git a/package/skeleton-init-systemd/fakeroot_tmpfiles.sh b/package/skeleton-init-systemd/fakeroot_tmpfiles.sh
index 9498638f0b..5381750500 100755
--- a/package/skeleton-init-systemd/fakeroot_tmpfiles.sh
+++ b/package/skeleton-init-systemd/fakeroot_tmpfiles.sh
@@ -25,7 +25,7 @@
# [1] - https://github.com/systemd/systemd/pull/16187
[ -n "${HOST_SYSTEMD_TMPFILES-}" ] ||
- HOST_SYSTEMD_TMPFILES=systemd-tmpfiles
+ HOST_SYSTEMD_TMPFILES=systemd-tmpfiles.standalone
[ -n "${1-}" -a -d "${1-}"/usr/lib/tmpfiles.d ] ||
{ echo 1>&2 "$0: need ROOTFS argument"; exit 1; }
diff --git a/package/skeleton-init-systemd/skeleton-init-systemd.mk b/package/skeleton-init-systemd/skeleton-init-systemd.mk
index b312fe33e4..cd51ce209a 100644
--- a/package/skeleton-init-systemd/skeleton-init-systemd.mk
+++ b/package/skeleton-init-systemd/skeleton-init-systemd.mk
@@ -80,7 +80,7 @@ endif # BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW
ifeq ($(BR2_INIT_SYSTEMD_POPULATE_TMPFILES),y)
define SKELETON_INIT_SYSTEMD_CREATE_TMPFILES_HOOK
- HOST_SYSTEMD_TMPFILES=$(HOST_DIR)/bin/systemd-tmpfiles \
+ HOST_SYSTEMD_TMPFILES=$(HOST_DIR)/bin/systemd-tmpfiles.standalone \
$(SKELETON_INIT_SYSTEMD_PKGDIR)/fakeroot_tmpfiles.sh $(TARGET_DIR)
endef
SKELETON_INIT_SYSTEMD_ROOTFS_PRE_CMD_HOOKS += SKELETON_INIT_SYSTEMD_CREATE_TMPFILES_HOOK
diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk
index 5dca8681bc..9a18d91533 100644
--- a/package/systemd/systemd.mk
+++ b/package/systemd/systemd.mk
@@ -899,6 +899,17 @@ endef
# We need a very minimal host variant, so we disable as much as possible.
HOST_SYSTEMD_CONF_OPTS = \
-Dsplit-bin=true \
+ -Dlink-udev-shared=false \
+ -Dlink-executor-shared=false \
+ -Dlink-systemctl-shared=false \
+ -Dlink-networkd-shared=false \
+ -Dlink-timesyncd-shared=false \
+ -Dlink-journalctl-shared=false \
+ -Dlink-boot-shared=false \
+ -Dlink-portabled-shared=false \
+ -Dstatic-libsystemd=true \
+ -Dstatic-libudev=true \
+ -Dstandalone-binaries=true \
--prefix=/usr \
--libdir=lib \
--sysconfdir=/etc \
@@ -1022,24 +1033,5 @@ HOST_SYSTEMD_DEPENDENCIES = \
HOST_SYSTEMD_NINJA_ENV = DESTDIR=$(HOST_DIR)
-# Fix RPATH After installation
-# * systemd provides a install_rpath instruction to meson because the binaries
-# need to link with libsystemd which is not in a standard path
-# * meson can only replace the RPATH, not append to it
-# * the original rpath is thus lost.
-# * the original path had been tweaked by buildroot via LDFLAGS to add
-# $(HOST_DIR)/lib
-# * thus re-tweak rpath after the installation for all binaries that need it
-HOST_SYSTEMD_HOST_TOOLS = busctl journalctl systemctl systemd-* udevadm
-
-define HOST_SYSTEMD_FIX_RPATH
- for f in $(addprefix $(HOST_DIR)/bin/,$(HOST_SYSTEMD_HOST_TOOLS)); do \
- [ -e $$f ] || continue; \
- $(HOST_DIR)/bin/patchelf --set-rpath $(HOST_DIR)/lib:$(HOST_DIR)/lib/systemd $${f} \
- || exit 1; \
- done
-endef
-HOST_SYSTEMD_POST_INSTALL_HOOKS += HOST_SYSTEMD_FIX_RPATH
-
$(eval $(meson-package))
$(eval $(host-meson-package))
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Buildroot] [PATCH 1/1] package/systemd: link host systemd utilities statically
2024-09-10 19:36 [Buildroot] [PATCH 1/1] package/systemd: link host systemd utilities statically James Hilliard
@ 2024-09-11 16:44 ` Yann E. MORIN
2024-09-11 17:07 ` James Hilliard
0 siblings, 1 reply; 4+ messages in thread
From: Yann E. MORIN @ 2024-09-11 16:44 UTC (permalink / raw)
To: James Hilliard; +Cc: Norbert Lange, Sen Hastings, buildroot
James, All,
On 2024-09-10 13:36 -0600, James Hilliard spake thusly:
> This makes it less likely that we will run into missing library
> errors when running host systemd utilities
What error exactly are you trying to fix here?
Why does it happen only now?
Stating "less likekely" implies that it is not systematic, so there are
conditions that trigger it. What conditions would tht be, so we can try
and reproduce the issue?
While "missing libraries" is atually an issue, what library are missing?
Why are they missing?
These are critical information that must be present in the commit log.
Let me guess. You are hitting the same issue as reported there:
https://gitlab.com/buildroot.org/buildroot/-/issues/39
If so, then I think your patch is just hidding the dust under the rug.
Indeed, it is possible that other packages suffer from the same issue,
and we certainly do not want to build all such packages statically.
Instead, we want to fix the rpath fixups (he! fix the fixups!).
Regards,
Yann E. MORIN.
> and lets us remove the
> HOST_SYSTEMD_FIX_RPATH hack.
> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
> ---
> .../fakeroot_tmpfiles.sh | 2 +-
> .../skeleton-init-systemd.mk | 2 +-
> package/systemd/systemd.mk | 30 +++++++------------
> 3 files changed, 13 insertions(+), 21 deletions(-)
>
> diff --git a/package/skeleton-init-systemd/fakeroot_tmpfiles.sh b/package/skeleton-init-systemd/fakeroot_tmpfiles.sh
> index 9498638f0b..5381750500 100755
> --- a/package/skeleton-init-systemd/fakeroot_tmpfiles.sh
> +++ b/package/skeleton-init-systemd/fakeroot_tmpfiles.sh
> @@ -25,7 +25,7 @@
> # [1] - https://github.com/systemd/systemd/pull/16187
>
> [ -n "${HOST_SYSTEMD_TMPFILES-}" ] ||
> - HOST_SYSTEMD_TMPFILES=systemd-tmpfiles
> + HOST_SYSTEMD_TMPFILES=systemd-tmpfiles.standalone
>
> [ -n "${1-}" -a -d "${1-}"/usr/lib/tmpfiles.d ] ||
> { echo 1>&2 "$0: need ROOTFS argument"; exit 1; }
> diff --git a/package/skeleton-init-systemd/skeleton-init-systemd.mk b/package/skeleton-init-systemd/skeleton-init-systemd.mk
> index b312fe33e4..cd51ce209a 100644
> --- a/package/skeleton-init-systemd/skeleton-init-systemd.mk
> +++ b/package/skeleton-init-systemd/skeleton-init-systemd.mk
> @@ -80,7 +80,7 @@ endif # BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW
>
> ifeq ($(BR2_INIT_SYSTEMD_POPULATE_TMPFILES),y)
> define SKELETON_INIT_SYSTEMD_CREATE_TMPFILES_HOOK
> - HOST_SYSTEMD_TMPFILES=$(HOST_DIR)/bin/systemd-tmpfiles \
> + HOST_SYSTEMD_TMPFILES=$(HOST_DIR)/bin/systemd-tmpfiles.standalone \
> $(SKELETON_INIT_SYSTEMD_PKGDIR)/fakeroot_tmpfiles.sh $(TARGET_DIR)
> endef
> SKELETON_INIT_SYSTEMD_ROOTFS_PRE_CMD_HOOKS += SKELETON_INIT_SYSTEMD_CREATE_TMPFILES_HOOK
> diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk
> index 5dca8681bc..9a18d91533 100644
> --- a/package/systemd/systemd.mk
> +++ b/package/systemd/systemd.mk
> @@ -899,6 +899,17 @@ endef
> # We need a very minimal host variant, so we disable as much as possible.
> HOST_SYSTEMD_CONF_OPTS = \
> -Dsplit-bin=true \
> + -Dlink-udev-shared=false \
> + -Dlink-executor-shared=false \
> + -Dlink-systemctl-shared=false \
> + -Dlink-networkd-shared=false \
> + -Dlink-timesyncd-shared=false \
> + -Dlink-journalctl-shared=false \
> + -Dlink-boot-shared=false \
> + -Dlink-portabled-shared=false \
> + -Dstatic-libsystemd=true \
> + -Dstatic-libudev=true \
> + -Dstandalone-binaries=true \
> --prefix=/usr \
> --libdir=lib \
> --sysconfdir=/etc \
> @@ -1022,24 +1033,5 @@ HOST_SYSTEMD_DEPENDENCIES = \
>
> HOST_SYSTEMD_NINJA_ENV = DESTDIR=$(HOST_DIR)
>
> -# Fix RPATH After installation
> -# * systemd provides a install_rpath instruction to meson because the binaries
> -# need to link with libsystemd which is not in a standard path
> -# * meson can only replace the RPATH, not append to it
> -# * the original rpath is thus lost.
> -# * the original path had been tweaked by buildroot via LDFLAGS to add
> -# $(HOST_DIR)/lib
> -# * thus re-tweak rpath after the installation for all binaries that need it
> -HOST_SYSTEMD_HOST_TOOLS = busctl journalctl systemctl systemd-* udevadm
> -
> -define HOST_SYSTEMD_FIX_RPATH
> - for f in $(addprefix $(HOST_DIR)/bin/,$(HOST_SYSTEMD_HOST_TOOLS)); do \
> - [ -e $$f ] || continue; \
> - $(HOST_DIR)/bin/patchelf --set-rpath $(HOST_DIR)/lib:$(HOST_DIR)/lib/systemd $${f} \
> - || exit 1; \
> - done
> -endef
> -HOST_SYSTEMD_POST_INSTALL_HOOKS += HOST_SYSTEMD_FIX_RPATH
> -
> $(eval $(meson-package))
> $(eval $(host-meson-package))
> --
> 2.34.1
>
--
.-----------------.--------------------.------------------.--------------------.
| 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Buildroot] [PATCH 1/1] package/systemd: link host systemd utilities statically
2024-09-11 16:44 ` Yann E. MORIN
@ 2024-09-11 17:07 ` James Hilliard
2024-09-11 19:14 ` Yann E. MORIN
0 siblings, 1 reply; 4+ messages in thread
From: James Hilliard @ 2024-09-11 17:07 UTC (permalink / raw)
To: Yann E. MORIN; +Cc: Norbert Lange, Sen Hastings, buildroot
On Wed, Sep 11, 2024 at 10:44 AM Yann E. MORIN <yann.morin.1998@free.fr> wrote:
>
> James, All,
>
> On 2024-09-10 13:36 -0600, James Hilliard spake thusly:
> > This makes it less likely that we will run into missing library
> > errors when running host systemd utilities
>
> What error exactly are you trying to fix here?
> Why does it happen only now?
>
> Stating "less likekely" implies that it is not systematic, so there are
> conditions that trigger it. What conditions would tht be, so we can try
> and reproduce the issue?
>
> While "missing libraries" is atually an issue, what library are missing?
> Why are they missing?
>
> These are critical information that must be present in the commit log.
>
> Let me guess. You are hitting the same issue as reported there:
> https://gitlab.com/buildroot.org/buildroot/-/issues/39
Yeah, looks like the same issue, I hadn't really isolated it fully
but had seen issues related to this in the past when working
on a different patch series involving using meson's native install.
>
> If so, then I think your patch is just hidding the dust under the rug.
>
> Indeed, it is possible that other packages suffer from the same issue,
> and we certainly do not want to build all such packages statically.
I thought this was generally only affecting systemd.
>
> Instead, we want to fix the rpath fixups (he! fix the fixups!).
>
> Regards,
> Yann E. MORIN.
>
> > and lets us remove the
> > HOST_SYSTEMD_FIX_RPATH hack.
>
> > Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
> > ---
> > .../fakeroot_tmpfiles.sh | 2 +-
> > .../skeleton-init-systemd.mk | 2 +-
> > package/systemd/systemd.mk | 30 +++++++------------
> > 3 files changed, 13 insertions(+), 21 deletions(-)
> >
> > diff --git a/package/skeleton-init-systemd/fakeroot_tmpfiles.sh b/package/skeleton-init-systemd/fakeroot_tmpfiles.sh
> > index 9498638f0b..5381750500 100755
> > --- a/package/skeleton-init-systemd/fakeroot_tmpfiles.sh
> > +++ b/package/skeleton-init-systemd/fakeroot_tmpfiles.sh
> > @@ -25,7 +25,7 @@
> > # [1] - https://github.com/systemd/systemd/pull/16187
> >
> > [ -n "${HOST_SYSTEMD_TMPFILES-}" ] ||
> > - HOST_SYSTEMD_TMPFILES=systemd-tmpfiles
> > + HOST_SYSTEMD_TMPFILES=systemd-tmpfiles.standalone
> >
> > [ -n "${1-}" -a -d "${1-}"/usr/lib/tmpfiles.d ] ||
> > { echo 1>&2 "$0: need ROOTFS argument"; exit 1; }
> > diff --git a/package/skeleton-init-systemd/skeleton-init-systemd.mk b/package/skeleton-init-systemd/skeleton-init-systemd.mk
> > index b312fe33e4..cd51ce209a 100644
> > --- a/package/skeleton-init-systemd/skeleton-init-systemd.mk
> > +++ b/package/skeleton-init-systemd/skeleton-init-systemd.mk
> > @@ -80,7 +80,7 @@ endif # BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW
> >
> > ifeq ($(BR2_INIT_SYSTEMD_POPULATE_TMPFILES),y)
> > define SKELETON_INIT_SYSTEMD_CREATE_TMPFILES_HOOK
> > - HOST_SYSTEMD_TMPFILES=$(HOST_DIR)/bin/systemd-tmpfiles \
> > + HOST_SYSTEMD_TMPFILES=$(HOST_DIR)/bin/systemd-tmpfiles.standalone \
> > $(SKELETON_INIT_SYSTEMD_PKGDIR)/fakeroot_tmpfiles.sh $(TARGET_DIR)
> > endef
> > SKELETON_INIT_SYSTEMD_ROOTFS_PRE_CMD_HOOKS += SKELETON_INIT_SYSTEMD_CREATE_TMPFILES_HOOK
> > diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk
> > index 5dca8681bc..9a18d91533 100644
> > --- a/package/systemd/systemd.mk
> > +++ b/package/systemd/systemd.mk
> > @@ -899,6 +899,17 @@ endef
> > # We need a very minimal host variant, so we disable as much as possible.
> > HOST_SYSTEMD_CONF_OPTS = \
> > -Dsplit-bin=true \
> > + -Dlink-udev-shared=false \
> > + -Dlink-executor-shared=false \
> > + -Dlink-systemctl-shared=false \
> > + -Dlink-networkd-shared=false \
> > + -Dlink-timesyncd-shared=false \
> > + -Dlink-journalctl-shared=false \
> > + -Dlink-boot-shared=false \
> > + -Dlink-portabled-shared=false \
> > + -Dstatic-libsystemd=true \
> > + -Dstatic-libudev=true \
> > + -Dstandalone-binaries=true \
> > --prefix=/usr \
> > --libdir=lib \
> > --sysconfdir=/etc \
> > @@ -1022,24 +1033,5 @@ HOST_SYSTEMD_DEPENDENCIES = \
> >
> > HOST_SYSTEMD_NINJA_ENV = DESTDIR=$(HOST_DIR)
> >
> > -# Fix RPATH After installation
> > -# * systemd provides a install_rpath instruction to meson because the binaries
> > -# need to link with libsystemd which is not in a standard path
> > -# * meson can only replace the RPATH, not append to it
> > -# * the original rpath is thus lost.
> > -# * the original path had been tweaked by buildroot via LDFLAGS to add
> > -# $(HOST_DIR)/lib
> > -# * thus re-tweak rpath after the installation for all binaries that need it
> > -HOST_SYSTEMD_HOST_TOOLS = busctl journalctl systemctl systemd-* udevadm
> > -
> > -define HOST_SYSTEMD_FIX_RPATH
> > - for f in $(addprefix $(HOST_DIR)/bin/,$(HOST_SYSTEMD_HOST_TOOLS)); do \
> > - [ -e $$f ] || continue; \
> > - $(HOST_DIR)/bin/patchelf --set-rpath $(HOST_DIR)/lib:$(HOST_DIR)/lib/systemd $${f} \
> > - || exit 1; \
> > - done
> > -endef
> > -HOST_SYSTEMD_POST_INSTALL_HOOKS += HOST_SYSTEMD_FIX_RPATH
> > -
> > $(eval $(meson-package))
> > $(eval $(host-meson-package))
> > --
> > 2.34.1
> >
>
> --
> .-----------------.--------------------.------------------.--------------------.
> | 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Buildroot] [PATCH 1/1] package/systemd: link host systemd utilities statically
2024-09-11 17:07 ` James Hilliard
@ 2024-09-11 19:14 ` Yann E. MORIN
0 siblings, 0 replies; 4+ messages in thread
From: Yann E. MORIN @ 2024-09-11 19:14 UTC (permalink / raw)
To: James Hilliard; +Cc: Norbert Lange, Sen Hastings, buildroot
James, All,
On 2024-09-11 11:07 -0600, James Hilliard spake thusly:
> On Wed, Sep 11, 2024 at 10:44 AM Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> > On 2024-09-10 13:36 -0600, James Hilliard spake thusly:
> > > This makes it less likely that we will run into missing library
> > > errors when running host systemd utilities
> > What error exactly are you trying to fix here?
[--SNIP--]
> > Let me guess. You are hitting the same issue as reported there:
> > https://gitlab.com/buildroot.org/buildroot/-/issues/39
> Yeah, looks like the same issue, I hadn't really isolated it fully
> but had seen issues related to this in the past when working
> on a different patch series involving using meson's native install.
It would be good indeed if at some point we could get rid of our RPATH
hack in host-systemd. However, please review the commit log for
35c11a027c88 (package/systemd: add host variant) that explains at length
why we are doing it.
> > If so, then I think your patch is just hidding the dust under the rug.
> > Indeed, it is possible that other packages suffer from the same issue,
> > and we certainly do not want to build all such packages statically.
> I thought this was generally only affecting systemd.
Even if currently affects only systemd, the issue is really generic,and
I have sent a patch to actually fix the root cause;
https://patchwork.ozlabs.org/project/buildroot/patch/20240911190900.982461-1-yann.morin.1998@free.fr/
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. |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-09-11 19:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-10 19:36 [Buildroot] [PATCH 1/1] package/systemd: link host systemd utilities statically James Hilliard
2024-09-11 16:44 ` Yann E. MORIN
2024-09-11 17:07 ` James Hilliard
2024-09-11 19:14 ` Yann E. MORIN
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox