libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LD_LIBRARY_PATH set by wrapper on Ubuntu, not on Rocky (Redhat)


From: Vincent Lefevre
Subject: Re: LD_LIBRARY_PATH set by wrapper on Ubuntu, not on Rocky (Redhat)
Date: Tue, 6 Sep 2022 11:17:27 +0200
User-agent: Mutt/2.2.7+37 (a90f69b9) vl-149028 (2022-09-02)

On 2022-09-06 10:12:23 +0200, Frederic Berat wrote:
> The behavior is likely not due to patches on libtool (at least I
> couldn't find anything obviously relevant), but more probably to the
> default behavior of gnu ld.
> From the behavior described in the thread earlier, it looks like
> Debian has the "--enable-dtags" option set to ld, while Redhat doesn't
> have it. That leads to RUNPATH being set on Debian while RPATH is set
> on REDHAT, which by side effect modifies the behavior of libtool, if I
> get it right.
> 
> Interestingly, Vincent opened a bug report in Debian a few years ago
> [1], complaining that "--enable-dtags" was breaking tests generated by
> libtool. I wonder if there was any follow-up on this, and what was the
> conclusion.
> 
> [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=859732

Unfortunately, as you can see, there were no answers. So I ended up
by explicitly disabling dtags for GNU MPFR (when supported):

dnl Under Linux, make sure that the old dtags are used if LD_LIBRARY_PATH
dnl is defined. The issue is that with the new dtags, LD_LIBRARY_PATH has
dnl the precedence over the run path, so that if a compatible MPFR library
dnl is installed in some directory from $LD_LIBRARY_PATH, then the tested
dnl MPFR library will be this library instead of the MPFR library from the
dnl build tree. Other OS with the same issue might be added later.
dnl
dnl References:
dnl   https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=859732
dnl   https://lists.gnu.org/archive/html/libtool/2017-05/msg00000.html
dnl
dnl We need to check whether --disable-new-dtags is supported as alternate
dnl linkers may be used (e.g., with tcc: CC=tcc LD=tcc).
dnl
case $host in
  *-*-linux*)
    if test -n "$LD_LIBRARY_PATH"; then
      saved_LDFLAGS="$LDFLAGS"
      LDFLAGS="$LDFLAGS -Wl,--disable-new-dtags"
      AC_MSG_CHECKING(whether --disable-new-dtags is supported by the linker)
      AC_LINK_IFELSE([AC_LANG_SOURCE([[
int main (void) { return 0; }
      ]])],
      [AC_MSG_RESULT(yes (use it since LD_LIBRARY_PATH is set))],
      [AC_MSG_RESULT(no)
       LDFLAGS="$saved_LDFLAGS"
      ])
    fi
    ;;
esac

-- 
Vincent Lefèvre <vincent@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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]