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

Emmanuel Thomé Emmanuel.Thome at
Wed Jun 28 07:39:10 UTC 2017

On Wed, Jun 28, 2017 at 02:09:54AM +0200, Vincent Lefevre wrote:
> I meant either RPATH or RUNPATH (whatever is used by ld). Here it
> would be RPATH. Under Debian jessie, here's what I got for MPFR:
>   RPATH  /home/vlefevre/software/mpfr-3.1/src/.libs:/home/vlefevre/debian8/gmp/k10/lib
> /home/vlefevre/debian8/gmp/k10/lib was the current installation
> in my home dir, and /home/vlefevre/software/mpfr-3.1/src/.libs is
> the directory from the build tree. You should have got something
> similar, i.e.
>   RPATH  /home/ci/gmp-6.1.2/.libs:/tmp/inst/lib

That's not really consistent with using a libtool wrapper. You said that
with mpfr you make do without the wrapper. I think that is the reason for
libtool embedding ..../src/.libs in the RPATH (at least that's what I
observe if I stick in AM_LDFLAGS = -no-install).

> > I'm skeptical about the intent to mention the current directory as a
> > r(un)path as well. Are you sure it's ever done that way ?
> Not the current directory, but the directory that contains the
> library that has just been built.
> > > > Prepending "env LD_LIBRARY_PATH_RPATH=1" before running scripts in e.g.
> > > > make check or make tune would be a workaround, I suppose.
> > > 
> > > Generating a right RPATH would be a better solution.
> > 
> > What's your definition of "right" ?
> See above.

I beg to differ. Surely various options can be considered. Depending on
the use case, one might be preferred to another.
 - For a non-installed binary, probably -no-install is best.
 - One cannot completely rule out the case of an installed binary which
   also gets run within the build process.  Then I certainly don't want
   to see the build path appear as an rpath ! So the "right" thing can't
   be the same.
 - Granting libtool's wrapper script the power to override the binary's
   embedded rpath information is not absurd after all. It's
   idiosyncrasy-fixing, but that's really what libtool is all about...

Long story short, I think that gmp (and my package gf2x) have the
following options:
 - AM_LDFLAGS = -no-install in {tune,tests}/
 - env LD_LIBRARY_PATH_RPATH=1 prepended to tuning and test runs
 - use a fixed libtool at ./ time (see )

Thanks Vincent for your feedback, that was really helpful.


More information about the gmp-bugs mailing list