All of lore.kernel.org
 help / color / mirror / Atom feed
* minor curiosity related to libdir vs base_libdir and shared libs
@ 2021-09-05 20:01 Robert P. J. Day
  2021-09-07  7:06 ` [OE-core] " Andre McCurdy
  0 siblings, 1 reply; 4+ messages in thread
From: Robert P. J. Day @ 2021-09-05 20:01 UTC (permalink / raw)
  To: OE Core mailing list


  a minor oddity i stumbled over digging into the proper installation
of shared libraries ... building core-image-minimal for qemuarm64 and,
for the most part, recipes from oe-core that install shared libs put
all three artifacts (real name, so name and linker name) under
/usr/lib, as in:

  ./libtirpc/1.3.2-r0/image/usr/lib/libtirpc.so
  ./libtirpc/1.3.2-r0/image/usr/lib/libtirpc.so.3
  ./libtirpc/1.3.2-r0/image/usr/lib/libtirpc.so.3.0.0

however, the *occasional* recipe chooses to -- for whatever reason --
distinguish between libdir and base_libdir. for example, here's the
result of installing tcp-wrappers' shared libs in its ${D} directory:

  ./tcp-wrappers/7.6-r10/image/lib/libwrap.so.0.7.6
  ./tcp-wrappers/7.6-r10/image/lib/libwrap.so.0
  ./tcp-wrappers/7.6-r10/image/usr/lib/libwrap.so

this is due to the following manual override in tcp-wrappers_7.6.bb:

  do_install () {
        oe_libinstall -a libwrap ${D}${libdir}
        oe_libinstall -C shared -so libwrap ${D}${base_libdir}

        if [ "${libdir}" != "${base_libdir}" ] ; then
                rel_lib_prefix=`echo ${libdir} | sed 's,\(^/\|\)[^/][^/]*,..,g'`
                libname=`readlink ${D}${base_libdir}/libwrap.so | xargs basename`
                ln -s ${rel_lib_prefix}${base_libdir}/${libname} ${D}${libdir}/libwrap.so
                rm -f ${D}${base_libdir}/libwrap.so
        fi
        ...

so this recipe -- after doing the *default* shared lib installation
via oe_libinstall() -- conditionally chooses to override that.

  another recipe that is even odder is libcap-ng:

  ./libcap-ng/0.8.2-r0/image/lib/libcap-ng.so.0.0.0
  ./libcap-ng/0.8.2-r0/image/lib/libcap-ng.so.0
  ./libcap-ng/0.8.2-r0/image/usr/lib/libcap-ng.so
  ./libcap-ng/0.8.2-r0/image/usr/lib/libdrop_ambient.so.0
  ./libcap-ng/0.8.2-r0/image/usr/lib/libdrop_ambient.so
  ./libcap-ng/0.8.2-r0/image/usr/lib/libdrop_ambient.so.0.0.0

which seems odd since it does that override for *one* of the shared
libs that it generates, but not the other:

  do_install:append() {
        # Moving libcap-ng to base_libdir
        if [ ! ${D}${libdir} -ef ${D}${base_libdir} ]; then
                mkdir -p ${D}/${base_libdir}/
                mv -f ${D}${libdir}/libcap-ng.so.* ${D}${base_libdir}/
                relpath=${@os.path.relpath("${base_libdir}", "${libdir}")}
                ln -sf ${relpath}/libcap-ng.so.0.0.0 ${D}${libdir}/libcap-ng.so
        fi
  }

given that almost all other recipes seem happy to just stuff all that
under /usr/lib, what is the rationale for the above occasional
difference? it pretty clearly doesn't affect functionality; it just
looks strange.

rday

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [OE-core] minor curiosity related to libdir vs base_libdir and shared libs
  2021-09-05 20:01 minor curiosity related to libdir vs base_libdir and shared libs Robert P. J. Day
@ 2021-09-07  7:06 ` Andre McCurdy
  2021-09-07  8:34   ` Robert P. J. Day
  2021-09-07  8:46   ` Robert P. J. Day
  0 siblings, 2 replies; 4+ messages in thread
From: Andre McCurdy @ 2021-09-07  7:06 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: OE Core mailing list

On Sun, Sep 5, 2021 at 1:02 PM Robert P. J. Day <rpjday@crashcourse.ca> wrote:
>   a minor oddity i stumbled over digging into the proper installation
> of shared libraries ... building core-image-minimal for qemuarm64 and,
> for the most part, recipes from oe-core that install shared libs put
> all three artifacts (real name, so name and linker name) under
> /usr/lib, as in:
>
>   ./libtirpc/1.3.2-r0/image/usr/lib/libtirpc.so
>   ./libtirpc/1.3.2-r0/image/usr/lib/libtirpc.so.3
>   ./libtirpc/1.3.2-r0/image/usr/lib/libtirpc.so.3.0.0
>
> however, the *occasional* recipe chooses to -- for whatever reason --
> distinguish between libdir and base_libdir. for example, here's the
> result of installing tcp-wrappers' shared libs in its ${D} directory:
>
>   ./tcp-wrappers/7.6-r10/image/lib/libwrap.so.0.7.6
>   ./tcp-wrappers/7.6-r10/image/lib/libwrap.so.0
>   ./tcp-wrappers/7.6-r10/image/usr/lib/libwrap.so
>
> this is due to the following manual override in tcp-wrappers_7.6.bb:
>
>   do_install () {
>         oe_libinstall -a libwrap ${D}${libdir}
>         oe_libinstall -C shared -so libwrap ${D}${base_libdir}
>
>         if [ "${libdir}" != "${base_libdir}" ] ; then
>                 rel_lib_prefix=`echo ${libdir} | sed 's,\(^/\|\)[^/][^/]*,..,g'`
>                 libname=`readlink ${D}${base_libdir}/libwrap.so | xargs basename`
>                 ln -s ${rel_lib_prefix}${base_libdir}/${libname} ${D}${libdir}/libwrap.so
>                 rm -f ${D}${base_libdir}/libwrap.so
>         fi
>         ...
>
> so this recipe -- after doing the *default* shared lib installation
> via oe_libinstall() -- conditionally chooses to override that.

git blame is often the best starting point for understanding why
things are done in a certain way. In this case the comment from the
original comment (from 11 years ago..) references portmap, which is no
longer supported by oe-core:

  https://git.openembedded.org/openembedded-core/commit/?id=6ffc4f2e04f2d405b14f198220a3613d386489e7

>   another recipe that is even odder is libcap-ng:
>
>   ./libcap-ng/0.8.2-r0/image/lib/libcap-ng.so.0.0.0
>   ./libcap-ng/0.8.2-r0/image/lib/libcap-ng.so.0
>   ./libcap-ng/0.8.2-r0/image/usr/lib/libcap-ng.so
>   ./libcap-ng/0.8.2-r0/image/usr/lib/libdrop_ambient.so.0
>   ./libcap-ng/0.8.2-r0/image/usr/lib/libdrop_ambient.so
>   ./libcap-ng/0.8.2-r0/image/usr/lib/libdrop_ambient.so.0.0.0
>
> which seems odd since it does that override for *one* of the shared
> libs that it generates, but not the other:
>
>   do_install:append() {
>         # Moving libcap-ng to base_libdir
>         if [ ! ${D}${libdir} -ef ${D}${base_libdir} ]; then
>                 mkdir -p ${D}/${base_libdir}/
>                 mv -f ${D}${libdir}/libcap-ng.so.* ${D}${base_libdir}/
>                 relpath=${@os.path.relpath("${base_libdir}", "${libdir}")}
>                 ln -sf ${relpath}/libcap-ng.so.0.0.0 ${D}${libdir}/libcap-ng.so
>         fi
>   }

The original commit from 2013 gives a few more clues in this case:

  https://git.yoctoproject.org/cgit/cgit.cgi/meta-selinux/commit/?id=587fdba43a7747992995029a88d3051ef0efe7f6

It's not explicit which QA test was being triggered but presumably it
was "unsafe-references-in-binaries", which has since been dropped from
oe-core:

  https://git.openembedded.org/openembedded-core/commit/?id=a6af5bbf3dad6f0951c67a0aae13ef86a8906893

So... it looks like these examples of moving libs to base_libdir are
obsolete and can be dropped.

Some comments in insane.bbclass left behind when the
unsafe-references-in-binaries and unsafe-references-in-scripts QA
tests were removed can be dropped too.

> given that almost all other recipes seem happy to just stuff all that
> under /usr/lib, what is the rationale for the above occasional
> difference? it pretty clearly doesn't affect functionality; it just
> looks strange.
>
> rday
>
> 
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [OE-core] minor curiosity related to libdir vs base_libdir and shared libs
  2021-09-07  7:06 ` [OE-core] " Andre McCurdy
@ 2021-09-07  8:34   ` Robert P. J. Day
  2021-09-07  8:46   ` Robert P. J. Day
  1 sibling, 0 replies; 4+ messages in thread
From: Robert P. J. Day @ 2021-09-07  8:34 UTC (permalink / raw)
  To: Andre McCurdy; +Cc: OE Core mailing list

On Tue, 7 Sep 2021, Andre McCurdy wrote:

> On Sun, Sep 5, 2021 at 1:02 PM Robert P. J. Day <rpjday@crashcourse.ca> wrote:
> >   a minor oddity i stumbled over digging into the proper installation
> > of shared libraries ... building core-image-minimal for qemuarm64 and,
> > for the most part, recipes from oe-core that install shared libs put
> > all three artifacts (real name, so name and linker name) under
> > /usr/lib, as in:
> >
> >   ./libtirpc/1.3.2-r0/image/usr/lib/libtirpc.so
> >   ./libtirpc/1.3.2-r0/image/usr/lib/libtirpc.so.3
> >   ./libtirpc/1.3.2-r0/image/usr/lib/libtirpc.so.3.0.0
> >
> > however, the *occasional* recipe chooses to -- for whatever reason --
> > distinguish between libdir and base_libdir. for example, here's the
> > result of installing tcp-wrappers' shared libs in its ${D} directory:
> >
> >   ./tcp-wrappers/7.6-r10/image/lib/libwrap.so.0.7.6
> >   ./tcp-wrappers/7.6-r10/image/lib/libwrap.so.0
> >   ./tcp-wrappers/7.6-r10/image/usr/lib/libwrap.so
> >
> > this is due to the following manual override in tcp-wrappers_7.6.bb:
> >
> >   do_install () {
> >         oe_libinstall -a libwrap ${D}${libdir}
> >         oe_libinstall -C shared -so libwrap ${D}${base_libdir}
> >
> >         if [ "${libdir}" != "${base_libdir}" ] ; then
> >                 rel_lib_prefix=`echo ${libdir} | sed 's,\(^/\|\)[^/][^/]*,..,g'`
> >                 libname=`readlink ${D}${base_libdir}/libwrap.so | xargs basename`
> >                 ln -s ${rel_lib_prefix}${base_libdir}/${libname} ${D}${libdir}/libwrap.so
> >                 rm -f ${D}${base_libdir}/libwrap.so
> >         fi
> >         ...
> >
> > so this recipe -- after doing the *default* shared lib installation
> > via oe_libinstall() -- conditionally chooses to override that.
>
> git blame is often the best starting point for understanding why
> things are done in a certain way. In this case the comment from the
> original comment (from 11 years ago..) references portmap, which is no
> longer supported by oe-core:
>
>   https://git.openembedded.org/openembedded-core/commit/?id=6ffc4f2e04f2d405b14f198220a3613d386489e7
>
> >   another recipe that is even odder is libcap-ng:
> >
> >   ./libcap-ng/0.8.2-r0/image/lib/libcap-ng.so.0.0.0
> >   ./libcap-ng/0.8.2-r0/image/lib/libcap-ng.so.0
> >   ./libcap-ng/0.8.2-r0/image/usr/lib/libcap-ng.so
> >   ./libcap-ng/0.8.2-r0/image/usr/lib/libdrop_ambient.so.0
> >   ./libcap-ng/0.8.2-r0/image/usr/lib/libdrop_ambient.so
> >   ./libcap-ng/0.8.2-r0/image/usr/lib/libdrop_ambient.so.0.0.0
> >
> > which seems odd since it does that override for *one* of the shared
> > libs that it generates, but not the other:
> >
> >   do_install:append() {
> >         # Moving libcap-ng to base_libdir
> >         if [ ! ${D}${libdir} -ef ${D}${base_libdir} ]; then
> >                 mkdir -p ${D}/${base_libdir}/
> >                 mv -f ${D}${libdir}/libcap-ng.so.* ${D}${base_libdir}/
> >                 relpath=${@os.path.relpath("${base_libdir}", "${libdir}")}
> >                 ln -sf ${relpath}/libcap-ng.so.0.0.0 ${D}${libdir}/libcap-ng.so
> >         fi
> >   }
>
> The original commit from 2013 gives a few more clues in this case:
>
>   https://git.yoctoproject.org/cgit/cgit.cgi/meta-selinux/commit/?id=587fdba43a7747992995029a88d3051ef0efe7f6
>
> It's not explicit which QA test was being triggered but presumably it
> was "unsafe-references-in-binaries", which has since been dropped from
> oe-core:
>
>   https://git.openembedded.org/openembedded-core/commit/?id=a6af5bbf3dad6f0951c67a0aae13ef86a8906893
>
> So... it looks like these examples of moving libs to base_libdir are
> obsolete and can be dropped.
>
> Some comments in insane.bbclass left behind when the
> unsafe-references-in-binaries and unsafe-references-in-scripts QA
> tests were removed can be dropped too.
>
> > given that almost all other recipes seem happy to just stuff all that
> > under /usr/lib, what is the rationale for the above occasional
> > difference? it pretty clearly doesn't affect functionality; it just
> > looks strange.

  thanks, i appreciate the research ... i was moderately curious about
what was happening, but i just didn't have the energy to go digging.
so it seems that it would be harmless to -- in the case of
tcp-wrappers -- just drop the following from its do_install() routine:

  do_install () {
        ... snip ...
        if [ "${libdir}" != "${base_libdir}" ] ; then
                rel_lib_prefix=`echo ${libdir} | sed 's,\(^/\|\)[^/][^/]*,..,g'`
                libname=`readlink ${D}${base_libdir}/libwrap.so | xargs basename`
                ln -s ${rel_lib_prefix}${base_libdir}/${libname} ${D}${libdir}/libwrap.so
                rm -f ${D}${base_libdir}/libwrap.so
        fi

is it worth the cleanup, or is that just useless churn for little
value?

rday

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [OE-core] minor curiosity related to libdir vs base_libdir and shared libs
  2021-09-07  7:06 ` [OE-core] " Andre McCurdy
  2021-09-07  8:34   ` Robert P. J. Day
@ 2021-09-07  8:46   ` Robert P. J. Day
  1 sibling, 0 replies; 4+ messages in thread
From: Robert P. J. Day @ 2021-09-07  8:46 UTC (permalink / raw)
  To: Andre McCurdy; +Cc: OE Core mailing list

On Tue, 7 Sep 2021, Andre McCurdy wrote:

... snip ...

> The original commit from 2013 gives a few more clues in this case:
>
>   https://git.yoctoproject.org/cgit/cgit.cgi/meta-selinux/commit/?id=587fdba43a7747992995029a88d3051ef0efe7f6
>
> It's not explicit which QA test was being triggered but presumably
> it was "unsafe-references-in-binaries", which has since been dropped
> from oe-core:
>
>   https://git.openembedded.org/openembedded-core/commit/?id=a6af5bbf3dad6f0951c67a0aae13ef86a8906893
>
> So... it looks like these examples of moving libs to base_libdir are
> obsolete and can be dropped.

  just for fun, there is the occasional recipe that relocates stuff in
the *other* direction, like this from e2fsprogs_1.46.4.bb:

  do_install () {
        oe_runmake 'DESTDIR=${D}' install
        oe_runmake 'DESTDIR=${D}' install-libs
        # We use blkid from util-linux now so remove from here
        rm -f ${D}${base_libdir}/libblkid*
        rm -rf ${D}${includedir}/blkid
        rm -f ${D}${base_libdir}/pkgconfig/blkid.pc
        rm -f ${D}${base_sbindir}/blkid
        rm -f ${D}${base_sbindir}/fsck
        rm -f ${D}${base_sbindir}/findfs

        # e2initrd_helper and the pkgconfig files belong in libdir
        if [ ! ${D}${libdir} -ef ${D}${base_libdir} ]; then
                install -d ${D}${libdir}
                mv ${D}${base_libdir}/e2initrd_helper ${D}${libdir}
                mv ${D}${base_libdir}/pkgconfig ${D}${libdir}
        fi
        ... snip ...

and libusb1_1.0.24.bb:

  do_install:append() {
        install -d ${D}${libdir}
        if [ ! ${D}${libdir} -ef ${D}${base_libdir} ]; then
                mv ${D}${base_libdir}/pkgconfig ${D}${libdir}
        fi
  }

anyway, i'll let others decide if that's worth tidying up.

rday

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-09-07  8:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-05 20:01 minor curiosity related to libdir vs base_libdir and shared libs Robert P. J. Day
2021-09-07  7:06 ` [OE-core] " Andre McCurdy
2021-09-07  8:34   ` Robert P. J. Day
2021-09-07  8:46   ` Robert P. J. Day

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.