strange install directory
Marc Glisse
marc.glisse at inria.fr
Fri Feb 26 19:15:21 UTC 2021
On Fri, 26 Feb 2021, Niels Möller wrote:
> Paul Zimmermann <Paul.Zimmermann at inria.fr> writes:
>
>> on the gcc118 machine from the gcc compile farm, with gmp-6.2.1, make install
>> puts the libgmp.{a,so} files in $PREFIX/lib64 instead of $PREFIX/lib. Is there
>> any reason for that?
>
> I don't know about GMP (and this is the first time I hear about
> automake's genered install target using a different default than
> libdir=${exec_prefix}/lib). Maybe a recent change in autoconf, automake,
> (or possibly libtool)? But I've been doing somethignsimilar in Nettle
> for years, and the problem case I want to avoid is this:
>
> 1. Assume we have a libfoo.so installed in /usr/local/lib, and that this
> is a the directory for 32-bit libraries.
>
> 2. User now builds and installs a new version of libfoo.so, for 64-bit
> abi, with default prefix. Say, "./configure CC='gcc -m64' && make &&
> make check && make install". If make install installs in
> /usr/local/lib, it will overwrite a working .so file with a new one
> completely breaking 32-bit programs on the system that depend on that
> 32-bit library.
>
> To avoid this kind of breakage one can apply some heuristics to tweak
> the default location, depending on the api built for, OS flavor, current
> structure under /usr/lib*, etc.
>
> Does it work to override it by explicitly passing --libdir=$PREFIX/lib?
We have CONFIG_SITE=/usr/share/site/aarch64-unknown-linux-gnu by default
in our environment on this machine, and this file does
# If user did not specify libdir, guess the correct target:
# Use lib64 for 64 bit bi-arch targets, keep the default for the rest.
if test "$libdir" = '${exec_prefix}/lib' ; then
[...]
so it looks like you can override it with anything but what you want (the
file is sourced by configure after it has set libdir).
Anyway, I think Paul's goal is more once GMP has been installed in lib64,
how can MPFR, knowing only the prefix, guess the right libdir? Except for
a hack of creating a dummy project, calling configure with that prefix,
and checking what libdir is used, I don't see a great way to do that.
Trying to use CONFIG_SITE directly would be messy. An alternative would be
to guess that if there is only one subdirectory lib* in prefix, that might
be it, or try each lib* until one works, hoping that the name never gets
weirder. You could also complain to SUSE...
--
Marc Glisse
More information about the gmp-devel
mailing list