FreeBSD links wrong library for tests if one is installed in $prefix

Vincent Lefevre vincent at vinc17.net
Tue Jun 27 12:43:50 UTC 2017


On 2017-06-27 13:28:52 +0200, Emmanuel Thome wrote:
> So in effect, GMP's make check links ./tests/mpn/t-mul with
> $prefix/lib/libgmp.so instead of ./libgmp.la.

This is strange since GMP instructs libtool to use temporary wrapper
scripts (well, this is the default), whose main goal is to solve this
issue in a reliable way.

AFAIK, in addition to the run path, these wrapper scripts also
modify LD_LIBRARY_PATH to put the local .libs directory first.
I suggest that you check on your FreeBSD machine.

So, everything should be fine, and the failure is very surprising.

Just make sure that you don't use some non-standard path-related
environment variable (unknown to libtool) with $prefix. I assume
that this includes LD_PRELOAD.

> When we get fireworks like this, that's fine. But it needs not always be
> so. One could imagine use cases where one is misled into thinking that
> some change to the source tree is harmless while in fact it isn't
> ---that's already more worrisome.
> 
> I've witnessed this with gmp-6.1.2 on FreeBSD 11.0 (amd64). Not on any
> other system. I came across this issue with the gf2x package I maintain,
> and it happens similarly with gmp. I wouldn't be surprised if the
> behaviour were the same with mpfr (Vincent ?).

MPFR instructs libtool *not* to use temporary wrapper scripts, as
they should be useless for the tests (as documented in the libtool
manual). This means that it completely relies on the run path.

But there's a new issue with MPFR since Debian's binutils is now
configured so that by default, LD_LIBRARY_PATH takes the precedence
over the RUN_PATH. Thus if the user has $prefix/lib in his own
LD_LIBRARY_PATH, one gets such failures:

  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=859732

It is possible to change the precedence when building the tests, but
this is not done by libtool by default. I think that this will have
to be fixed in MPFR.

I don't know the behavior with FreeBSD.

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


More information about the gmp-bugs mailing list