Re: minor curiosity related to libdir vs base_libdir and shared libs

Andre McCurdy

On Sun, Sep 5, 2021 at 1:02 PM Robert P. J. Day <rpjday@...> 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:


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:


this is due to the following manual override in

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}/ | xargs basename`
ln -s ${rel_lib_prefix}${base_libdir}/${libname} ${D}${libdir}/
rm -f ${D}${base_libdir}/

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:

another recipe that is even odder is libcap-ng:


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}/* ${D}${base_libdir}/
relpath=${@os.path.relpath("${base_libdir}", "${libdir}")}
ln -sf ${relpath}/ ${D}${libdir}/
The original commit from 2013 gives a few more clues in this case:

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

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.


Join to automatically receive all group messages.