[asterisk-bugs] [JIRA] (ASTERISK-26909) Libdir defaults to /usr/lib64 on systems that have a stray lib64 directory

Walter Doekes (JIRA) noreply at issues.asterisk.org
Thu Mar 30 02:19:10 CDT 2017


Walter Doekes created ASTERISK-26909:
----------------------------------------

             Summary: Libdir defaults to /usr/lib64 on systems that have a stray lib64 directory
                 Key: ASTERISK-26909
                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-26909
             Project: Asterisk
          Issue Type: Bug
      Security Level: None
          Components: Core/BuildSystem
    Affects Versions: 13.15.0
            Reporter: Walter Doekes


For ASTERISK-26705, commit bee55aaf2cc2936100b16f5a4acb87a3ea1235cd (branch 13) added this:
{noformat}
     * Fedora has a /usr/share/config.site that automatically tells
       autoconf to use /usr/lib64 but CentOS does not. This logic was
       copied to configure.ac and modified so systems like Ubuntu,
       which still use /usr/lib for 64-bit systems, aren't affected.
{noformat}
{noformat}
#
# The following code for detecting lib64 was taken from Fedora's
# /usr/share/config.site with a modification to check that the
# /usr/lib64 directory actually exists.  This prevents libdir from
# being set to /usr/lib64 on 64-bit systems that still use /usr/lib.
#
if test "$prefix" = /usr ||\
     { test "$prefix" = NONE && test "$ac_default_prefix" = /usr ; }
then
     for i in x86_64 ppc64 s390x aarch64; do
        if test $host_cpu = $i; then
           if test "$libdir" = '${exec_prefix}/lib' &&\
              { test -d "${exec_prefix}/lib64" || test -d "${ac_default_prefix}/lib64" ; } ; then
              libdir='${exec_prefix}/lib64'
              AC_MSG_NOTICE([ Setting libdir=${libdir} ])
           fi
           break
        fi
     done
fi
{noformat}

The comment is not entirely correct. Debian and Ubuntu are not systems that "still use /usr/lib", they're systems using a different schema ("multiarch" and /usr/lib/x86_64-linux-gnu, but not /usr/lib64).

However, if some installer at one point has created a /usr/lib64 directory on this system (I blame opensips), the asterisk libraries will also get placed into that wrong directory. The matters get worse if you create a debian package on a build OS that accidentally has a lib64 dir: now the binary archive package introduces libraries in /usr/lib64 onto other machines, propagating the existence of the lib64 directory that's not supposed to exist.

I propose to change the check from merely checking the existence, to checking for libc.so.*.

For example:
{noformat}
# head -n4 /etc/os-release 
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"

# if [ -e /usr/lib64/libc.so ] || [ -e /usr/lib64/libc.so.? ]; then echo we want lib64; fi
we want lib64
{noformat}
The above will be a bit more conservative in returning true but still return true for all systems which intentionally use /usr/lib64 (everyone has libc, right?).

We could change the comment to:
{noformat}
# The following code for detecting lib64 was taken from Fedora's
# /usr/share/config.site with a modification to check that the
# /usr/lib64/libc.so shared library actually exists.  This prevents
# libdir from being set to /usr/lib64 on 64-bit systems that do not
# use /usr/lib64.
{noformat}



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list