Subject: bug#57606: LD_LIBRARY_PATH is not set if compiler uses RPATH

From: Corey Minyard <[email-masked]>
Date: Mon, 5 Sep 2022 16:03:56 -0500

The libtool documentation states that searching LD_LIBRARY_PATH for
modules should work, under "10.4 Finding the correct name to dlopen":

     If your program uses this approach, then it should search the
  directories listed in the 'LD_LIBRARY_PATH'(1) environment variable, as
  well as the directory where libraries will eventually be installed.
  Searching this variable (or equivalent) will guarantee that your program
  can find its dlopened modules, even before installation, provided you
  have linked them using libtool.

I have a library and tools that were successfully using that technique
on Ubuntu.  When I tried to get them working on Redhat, it didn't work.
It turns out that on Redhat system RPATH is set in the library, not
RUNPATH, and in that case libtool will not set LD_LIBRARY_PATH,
presumably since RPATH will override LD_LIBRARY_PATH.

However, that doesn't match the documentation and breaks my code that
was trying to conform.  In my estimation, setting LD_LIBRARY_PATH in
that case won't hurt, so it should be easy to make the code match the
documentation.

-corey