diff mbox series

[3/4] glibc-package: move ldconfig to ML-specific file

Message ID 20250108071513.2807528-3-bbara93@gmail.com
State Accepted, archived
Commit 5b6b0cc57d4ac4ab18e963d494e079346b62bc68
Headers show
Series [1/4] multilib.conf: overwrite conf files for debs | expand

Commit Message

Benjamin Bara Jan. 8, 2025, 7:15 a.m. UTC
From: Benjamin Bara <benjamin.bara@skidata.com>

Otherwise, installing ldconfig via multilib results in overwriting.

Signed-off-by: Benjamin Bara <benjamin.bara@skidata.com>
---
 meta/recipes-core/glibc/glibc-package.inc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Richard Purdie Jan. 11, 2025, 6:42 p.m. UTC | #1
On Wed, 2025-01-08 at 08:15 +0100, Benjamin Bara via lists.openembedded.org wrote:
> From: Benjamin Bara <benjamin.bara@skidata.com>
> 
> Otherwise, installing ldconfig via multilib results in overwriting.
> 
> Signed-off-by: Benjamin Bara <benjamin.bara@skidata.com>
> ---
>  meta/recipes-core/glibc/glibc-package.inc | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/recipes-core/glibc/glibc-package.inc b/meta/recipes-core/glibc/glibc-package.inc
> index ad34b87929..1e7f3753c2 100644
> --- a/meta/recipes-core/glibc/glibc-package.inc
> +++ b/meta/recipes-core/glibc/glibc-package.inc
> @@ -28,7 +28,7 @@ INSANE_SKIP:${MLPREFIX}ldso:append = " dev-so libdir"
>  FILES:${PN} = "${libc_baselibs} ${libexecdir}/* ${sysconfdir}/ld.so.conf"
>  CONFFILES:${PN} = "${sysconfdir}/ld.so.conf"
>  RRECOMMENDS:${PN} = "${@bb.utils.contains('DISTRO_FEATURES', 'ldconfig', '${MLPREFIX}ldconfig', '', d)}"
> -FILES:ldconfig = "${base_sbindir}/ldconfig"
> +FILES:ldconfig = "${base_sbindir}/${MLPREFIX}ldconfig"
>  FILES:ldd = "${bindir}/ldd"
>  FILES:ldso = "${bindir}/${MLPREFIX}ld.so"
>  FILES:libmemusage = "${base_libdir}/libmemusage.so"
> @@ -123,6 +123,7 @@ do_install() {
>          ln -rs ${D}${base_libdir}/librt.so.1 ${D}${libdir}/librt.so
>          if [ -n "${MLPREFIX}" ]; then
>                  mv ${D}${bindir}/ld.so ${D}${bindir}/${MLPREFIX}ld.so
> +                mv ${D}${base_sbindir}/ldconfig ${D}${base_sbindir}/${MLPREFIX}ldconfig
>          fi
>  }

I'm a bit puzzled by what would use this in real world use. Do you have
systems where you have two different ld caches? Can our postinst code
call the right prefixed ldconfig binaries?

I merged the other patches in the series, thanks.

Cheers,

Richard
Benjamin Bara - SKIDATA Feb. 26, 2025, 3:23 p.m. UTC | #2
Hi Richard!

Thanks for your feedback and sorry for the late response.

On Sat, 2025-01-11 at 18:42 +0000, Richard Purdie wrote:
> On Wed, 2025-01-08 at 08:15 +0100, Benjamin Bara via
> lists.openembedded.org wrote:
> > From: Benjamin Bara <benjamin.bara@skidata.com>
> > 
> > Otherwise, installing ldconfig via multilib results in overwriting.
> > 
> > Signed-off-by: Benjamin Bara <benjamin.bara@skidata.com>
> > ---
> >  meta/recipes-core/glibc/glibc-package.inc | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/meta/recipes-core/glibc/glibc-package.inc
> > b/meta/recipes-core/glibc/glibc-package.inc
> > index ad34b87929..1e7f3753c2 100644
> > --- a/meta/recipes-core/glibc/glibc-package.inc
> > +++ b/meta/recipes-core/glibc/glibc-package.inc
> > @@ -28,7 +28,7 @@ INSANE_SKIP:${MLPREFIX}ldso:append = " dev-so
> > libdir"
> >  FILES:${PN} = "${libc_baselibs} ${libexecdir}/*
> > ${sysconfdir}/ld.so.conf"
> >  CONFFILES:${PN} = "${sysconfdir}/ld.so.conf"
> >  RRECOMMENDS:${PN} = "${@bb.utils.contains('DISTRO_FEATURES',
> > 'ldconfig', '${MLPREFIX}ldconfig', '', d)}"
> > -FILES:ldconfig = "${base_sbindir}/ldconfig"
> > +FILES:ldconfig = "${base_sbindir}/${MLPREFIX}ldconfig"
> >  FILES:ldd = "${bindir}/ldd"
> >  FILES:ldso = "${bindir}/${MLPREFIX}ld.so"
> >  FILES:libmemusage = "${base_libdir}/libmemusage.so"
> > @@ -123,6 +123,7 @@ do_install() {
> >          ln -rs ${D}${base_libdir}/librt.so.1
> > ${D}${libdir}/librt.so
> >          if [ -n "${MLPREFIX}" ]; then
> >                  mv ${D}${bindir}/ld.so
> > ${D}${bindir}/${MLPREFIX}ld.so
> > +                mv ${D}${base_sbindir}/ldconfig
> > ${D}${base_sbindir}/${MLPREFIX}ldconfig
> >          fi
> >  }
> 
> I'm a bit puzzled by what would use this in real world use. Do you
> have systems where you have two different ld caches? 

I haven't. My problem is that lib32-ldconfig is pulled in as a runtime
dependency (I think by dpkg; it isn't visible in the task-depends.dot
but during my tests I just added lib32-glibc so the possibilities where
it could come from are quite limited). This leads to a clash during
dpkg installation, because there are two /usr/bin/ldconfigs to install.

Unfortunately, I am not sure how to deal with this situation
"correctly". In fact, I think what I want to have is a single NON-ML
ldconfig binary which also considers the ML paths. ldconfig-native is
doing something similar with hardcoded paths[1], and I think something
like that might also be needed for a correctly working
${MLPREFIX}ldconfig. But probably I am wrong - I am quite inexperienced
when it comes to multilib environments or ld.so and its caching...

> Can our postinst code call the right prefixed ldconfig binaries?

It just calls the NON-ML ldconfig one, which doesn't consider the ML
libraries. However, when calling the other, the non-ML libraries are
removed - so not really an ideal situation.

Thanks & kind regards
Benjamin

[1]
https://git.openembedded.org/openembedded-core/tree/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-default-to-all-multilib-dirs.patch?h=yocto-5.0.7
diff mbox series

Patch

diff --git a/meta/recipes-core/glibc/glibc-package.inc b/meta/recipes-core/glibc/glibc-package.inc
index ad34b87929..1e7f3753c2 100644
--- a/meta/recipes-core/glibc/glibc-package.inc
+++ b/meta/recipes-core/glibc/glibc-package.inc
@@ -28,7 +28,7 @@  INSANE_SKIP:${MLPREFIX}ldso:append = " dev-so libdir"
 FILES:${PN} = "${libc_baselibs} ${libexecdir}/* ${sysconfdir}/ld.so.conf"
 CONFFILES:${PN} = "${sysconfdir}/ld.so.conf"
 RRECOMMENDS:${PN} = "${@bb.utils.contains('DISTRO_FEATURES', 'ldconfig', '${MLPREFIX}ldconfig', '', d)}"
-FILES:ldconfig = "${base_sbindir}/ldconfig"
+FILES:ldconfig = "${base_sbindir}/${MLPREFIX}ldconfig"
 FILES:ldd = "${bindir}/ldd"
 FILES:ldso = "${bindir}/${MLPREFIX}ld.so"
 FILES:libmemusage = "${base_libdir}/libmemusage.so"
@@ -123,6 +123,7 @@  do_install() {
         ln -rs ${D}${base_libdir}/librt.so.1 ${D}${libdir}/librt.so
         if [ -n "${MLPREFIX}" ]; then
                 mv ${D}${bindir}/ld.so ${D}${bindir}/${MLPREFIX}ld.so
+                mv ${D}${base_sbindir}/ldconfig ${D}${base_sbindir}/${MLPREFIX}ldconfig
         fi
 }