config.site for vendor libs on Fedora x86_64
Asked Answered
Y

1

1

I'm having trouble building a few Autotool-based libraries on Fedora 26, x86_64. The 64-bit Fedora puts third party and vendor libraries in /usr/local/lib64. Ubuntu 17 uses /usr/local/lib so the same projects build OK.

I've been using --libdir=/usr/local/lib64 but three libraries resist it. I lack a config.site for /usr/local so I am trying to add one. The Autoconf manual on Site Defaults is a tad bit confusing to me when it discusses usr/local's config.site. It says:

[discussion of /usr version of confg.site] ...

Likewise, on platforms where 64-bit libraries are built by default, then installed in /usr/local/lib64 instead of /usr/local/lib, it is appropriate to install /usr/local/share/config.site:

# /usr/local/share/config.site for platforms that prefer
# the directory /usr/local/lib64 over /usr/local/lib.
test "$libdir" = '${exec_prefix}/lib' && libdir='${exec_prefix}/lib64'

The problem I am having is, is the modification above appended to the /usr/local version of config.site? Or does it replace an existing block of code? Or can I just copy it where it belongs without modification?

Or maybe, what does a cat of /usr/local/share/config.site look like?


Here is the config.site for /usr. Its not clear to me if it needs modification or how to modify it.

$ cat /usr/share/config.site
# This is the config.site file to satisfy FHS defaults when installing below
# /usr.
#
# You may override this file by your config.site using the CONFIG_SITE env
# variable.
#
# Note: This file includes also RHEL/Fedora fix for installing libraries into
# "/lib/lib64" on 64bit systems.

if test -n "$host"; then
    # skip when cross-compiling
    return 0
fi

if test "$prefix" = /usr \
   || { test "$prefix" = NONE && test "$ac_default_prefix" = /usr ; }
then
    test "$sysconfdir" = '${prefix}/etc' && sysconfdir=/etc
    test "$sharedstatedir" = '${prefix}/com' && sharedstatedir=/var
    test "$localstatedir" = '${prefix}/var' && localstatedir=/var

    ARCH=`uname -m`
    for i in x86_64 ppc64 s390x aarch64; do
        if test $ARCH = $i; then
            test "$libdir" = '${exec_prefix}/lib' && libdir='${exec_prefix}/lib64'
            break
        fi
    done
fi
Yvonneyvonner answered 20/10, 2017 at 11:12 Comment(7)
I started to write an answer to the question as posed, but I think it would be a waste of time. If explicitly specifying the --libdir option does not result in your libraries going where you want them, then it seems unlikely that adding or modifying site defaults would do the trick, either. The point of the defaults is largely to avoid you having to specify installation locations by hand, but you're already past that.Radio
I recommend looking at the Makefile.am (supposing that Automake is in play) that directs the build of the libraries involved. It should not be too hard to modify it to honor the libdir you specify. Do, however, consider whether it may be purposeful that it does not already do so.Radio
Thanks @John. I've gathered some more information. Here's a Fedora spec file for one of the programs. Notice the use of sed to patch %{_libdir} in gnutls.spec. I guess my next question is, is GnuTLS doing the right thing by setting sys_lib_dlsearch_path_spec in the first place? It seems like Autotools/Autoconf should drive the entire process. That is, sys_lib_dlsearch_path_spec fiddling should not be present, and %{libdir} should be used throughout.Yvonneyvonner
@JohnBollinger - Should I ask a separate question for sys_lib_dlsearch_path_spec and gnutls.spec (is it too much for a comment)? That should allow you to answer this question about config.site in /usr/local with lib64 without worrying about the misbehaving projects. Then, in the new question, you can address the problems with sys_lib_dlsearch_path_spec.Yvonneyvonner
@JohnBollinger - I opened a question on the Autoconf mailing list: Autoconf and Fedora x86_64 /usr/local/lib64? I think I am too inexperienced with Autotools.Yvonneyvonner
I agree that it is odd that the Fedora SPEC file for gnutls needs to patch configure in that way. It is fairly common for these to patch configure to suppress RPATH entries being recorded in ELF objects, but I have never before seen a patch of the kind you're pointing out here. HOWEVER, I don't think it's directly related to your original question. I don't see how a patch such as that could affect where the build system installs libraries that it builds. It seems to be about where configure looks for shared libs that are already installed.Radio
Thanks again @John. Another question open on the site... Incorrect @libdir@ when using config.site? Autoconf leaves me with more questions than answers...Yvonneyvonner
Y
0

config.site for vendor libs on Fedora x86_64

This answers the question of what config.site looks like for /usr/local/share/config.site. It does not answer the question of why --libdir=/usr/local/lib64 fails to set the directory, as @John Bollinger pointed out in the comments.

The /usr/local/share/config.site is wrong. Though it was copied from Fedora's config.site and placed in /usr/local/share, the prefix directories are wrong. The prefix test should use /usr/local and not /usr.

Below is the corrected one.

$ cat /usr/local/share/config.site
...

if test -n "$host"; then
    # skip when cross-compiling
    return 0
fi

if test "$prefix" = /usr/local \
   || { test "$prefix" = NONE && test "$ac_default_prefix" = /usr/local ; }
then
    test "$sysconfdir" = '${prefix}/etc' && sysconfdir=/etc
    test "$sharedstatedir" = '${prefix}/com' && sharedstatedir=/var
    test "$localstatedir" = '${prefix}/var' && localstatedir=/var

    ARCH=`uname -m`
    for i in x86_64 ppc64 s390x aarch64; do
        if test $ARCH = $i; then
            test "$libdir" = '${exec_prefix}/lib' && libdir='${exec_prefix}/lib64'
            break
        fi
    done
fi

I'm not sure if these are correct, however. They were not modified.

test "$sysconfdir" = '${prefix}/etc' && sysconfdir=/etc
test "$sharedstatedir" = '${prefix}/com' && sharedstatedir=/var
test "$localstatedir" = '${prefix}/var' && localstatedir=/var

Now, the next question is, why Fedora's /usr/share/config.site is not handling prefix=/usr/local properly. That's an open question at Issue 1510073 : Autoconf does not honor libdir in config.site for "libdir=@libdir@" in *.pc file, which has been closed as NOT A BUG.

Yvonneyvonner answered 6/11, 2017 at 17:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.