setting LIBDIR_IN_LDCONFIG fails if /lib is a symlink to /usr/lib

Tomi Ollila tomi.ollila at iki.fi
Sun May 27 09:33:41 PDT 2018


On Sat, May 26 2018, David Bremner wrote:

> On my laptop, /lib is a symlink to to /usr/lib (this might or might not
> be a good idea, but is likely to become increasingly common if some
> people get their way).
>
> $ /sbin/ldconfig -NX -v | grep -v ^$'\t'
>
> yields
>
>         /sbin/ldconfig: Can't stat /usr/local/lib/x86_64-linux-gnu: No such file or directory
>         /sbin/ldconfig: Path `/usr/lib/x86_64-linux-gnu' given more than once
>         /sbin/ldconfig: Path `/lib/x86_64-linux-gnu' given more than once
>         /sbin/ldconfig: Path `/usr/lib/x86_64-linux-gnu' given more than once
>         /sbin/ldconfig: Path `/usr/lib' given more than once
>         /usr/lib/x86_64-linux-gnu/libfakeroot:
>         /usr/local/lib:
>         /lib/x86_64-linux-gnu:
>         /sbin/ldconfig: /lib/x86_64-linux-gnu/ld-2.27.so is the dynamic linker, ignoring
>
>         /lib:
>
> with libdir=/usr/lib/x86_64-linux-gnu, our sed hackery fails, since the
> directory we are looking for never appears at the beggining of a
> line.
>
> One option is to do more proccesing of the output and look for the path
> in "given more than once" lines as well. Still, this is an obviously
> fragile way of doing things (parsing human readable output from
> ldconfig), so I wondered if anyone has some better ideas.

we could try:

    for path in $ldconfig_paths; do
        if [ "$path" = "$libdir_expanded" ]; then
            libdir_in_ldconfig=1
            break
        fi
        if [ "$path" -ef "$libdir_expanded" ]; then
            libdir_in_ldconfig=1
            break
        fi
    done

>
> This informattion is used two places
>
> 1) to avoid adding an unecessary RPATH to the binary. Having such an RPATH will
> cause at least Debian (and I suppose other distro) tooling to complain
> loudly.
>
> 2) To know whether to run ldconfig after installing the library.


More information about the notmuch mailing list