Subject: pkg/35249: Sendmail fails to find libraries in /usr/pkg/lib on Linux.
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <lorenl@north-winds.org>
List: pkgsrc-bugs
Date: 12/13/2006 18:05:01
>Number:         35249
>Category:       pkg
>Synopsis:       Sendmail fails to find libraries in /usr/pkg/lib on Linux.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 13 18:05:01 +0000 2006
>Originator:     Loren M. Lang
>Release:        RedHat 9 Linux 2.4.20-20.9b
>Organization:
Alzatex, Inc.
>Environment:
Linux hosea.tallye.com 2.4.20-20.9b #1 SMP Wed Nov 19 22:14:33 PST 2003 i686 i686 i386 GNU/Linux
>Description:
I am using pkgsrc on Linux to replace parts of the Linux userland one-by-one.  Cyrus SASL, OpenSSL and OpenLDAP are installed from pkgsrc with older versions sitting under /usr and /usr/local.  The port mail/sendmail appears to install correctly, though none of the executables run due to missing libraries.  Specifically, it cannot find the ldap libraries that were installed into /usr/pkg/lib as the SONAME is different than installed under /usr/lib.

$/usr/pkg/libexec/sendmail/sendmail
/usr/pkg/libexec/sendmail/sendmail: error while loading shared libraries: libldap-2.3.so.0: cannot open shared object file: No such file or directory

$ldd /usr/pkg/libexec/sendmail/sendmail
        libssl.so.0.9.7 => /usr/lib/libssl.so.0.9.7 (0x4003a000)
        libsasl2.so.2 => /usr/local/lib/libsasl2.so.2 (0x40184000)
        libldap-2.3.so.0 => not found
        liblber-2.3.so.0 => not found
        libdb4-4.4.so.4 => not found
        ...

Looking in work/.work.log, I found no -R options to the linker or compiler.
>How-To-Repeat:
Install newer versions of OpenLDAP, BerkeleyDB, or other libraries onto a Linux system from pkgsrc, then install Sendmail from pkgsrc with the appropriate options enabled so that it depends on them and see that the generated binaries cannot find the libraries from pkgsrc unless /usr/pkg/lib is added to /etc/ld.so.conf and /sbin/ldconfig is re-ran.
>Fix:
A work-around on Linux is to add /usr/pkg/lib to /etc/ld.so.conf and run /sbin/ldconfig to update the library cache.  This causes sendmail from pkgsrc to find the appropriate libraries, but, of course, causes a lot of the base system programs to change to the libraries from pkgsrc.  The correct course of action is to have sendmail linked with the appropriate -R option.