Bug 2723 - automatic ldconfig does not always work properly
Summary: automatic ldconfig does not always work properly
Status: VERIFIED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: configuration (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Medium normal
Target Milestone: 1.3 M4
Assignee: Robert Yang
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2012-07-09 15:47 UTC by Mark Hatle
Modified: 2012-09-04 01:50 UTC (History)
6 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Hatle 2012-07-09 15:47:55 UTC
Two related items:

If baselib != "lib", there is a check in

> python package_do_shlibs() {
>          import re, pipes
>
>          exclude_shlibs = d.getVar('EXCLUDE_FROM_SHLIBS', 0)
>          if exclude_shlibs:
>                  bb.note("not generating shlibs")
>                  return
>
>          lib_re = re.compile("^.*\.so")
>          libdir_re = re.compile(".*/lib$")

The check should really be (or similar):

re.compile(".*/%s$" % d.getVar('baselib', True))


Then once the additional libraries are found, the ldconfig call will be automatically added..  the second issue happens when this call is made in a filesystem that does -not- contain ldconfig:


> in package_do_shlibs, we see:
>
>                 if needs_ldconfig and use_ldconfig:
>                          bb.debug(1, 'adding ldconfig call to postinst for %s' % pkg)
>                          postinst = d.getVar('pkg_postinst_%s' % pkg, True) or d.getVar('pkg_postinst', Tru
> e)
>                          if not postinst:
>                                  postinst = '#!/bin/sh\n'
>                          postinst += d.getVar('ldconfig_postinst_fragment', True)
>                          d.setVar('pkg_postinst_%s' % pkg, postinst)
>
> I see that ldconfig_postinst_frament is:
>
> ldconfig_postinst_fragment() {
> if [ x"$D" = "x" ]; then
>          [ -x /sbin/ldconfig ] && /sbin/ldconfig
> fi
> }

The problem is, at least in the case of RPM, the shell is run to check for non-zero return codes.  The [ -x /sbin/ldconfig ] returns non-zero, so the && never runs.. but the status is also never cleared.  This leads to an install failure.

My suggestion is to replace the line with:

if [ -x /sbin/ldconfig ]; then /sbin/ldconfig ; fi
Comment 1 Robert Yang 2012-08-27 03:41:28 UTC
This one had already been fixed by Amy Fong:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=b1c2b57b3eaf1d96985b60746555fd4d69bbed1c
Comment 2 liang li 2012-09-04 01:50:42 UTC
verified.