Hello all,

I'm a Guile developer who is trying to figure out the best way to add a
Guile-specific 'extensions' directory to the library search path, while
retaining the ability of 'libtool --mode=execute -dlopen' to take
precedence over our default extensions directory.

As I understand it, on GNU systems 'libtool --mode=execute -dlopen' has
the effect of prepending a directory to $LD_LIBRARY_PATH.  It also
appears from the libltdl source code that the search order for
'lt_dlopenext' is as follows:

* user_search_path (augmented by 'lt_dladdsearchdir' et al)
* LTDL_LIBRARY_PATH
* LD_LIBRARY_PATH
* system default search path

I see only two ways to add our extensions directory to the search path,
such that it can be overridden by 'libtool --mode=execute -dlopen':

1. Append it to LD_LIBRARY_PATH.
2. Search in our extensions directory manually if 'lt_dlopenext' fails,
   by calling 'lt_dlopenext' a second time.

The problem with option 1 is that all subprocesses will inherit our
modified search path.  This could be a problem if there are two
different versions of Guile on the system, and one is used by a
subprocess of the other, because the sub-Guile will search in the
parent-Guile's extensions directory first.

Therefore, it seems that option 2 is the right thing, even though it is
quite kludgy.

I can't help but suspect that 'lt_dladdsearchdir' et al were intended
for programs to add their own system-wide extensions directory to the
search path.  Is that right?  If so, what's the recommended way to
override a program's default extensions directory?

Maybe the problem is that programs should not expect 'libtool
--mode=execute -dlopen' to override a program's extension directory.
However, it is being used this way in practice, for example by GNU TLS
(which provides a Guile extension) to ask that the uninstalled extension
in its build directory should take precedence over the one in the
system-wide Guile extensions directory.  See
<http://git.savannah.gnu.org/cgit/gnutls.git/tree/guile/pre-inst-guile.in>.

I'm hoping that the libtool experts here can help me understand how this
is supposed to work.  I'm not subscribed to this list, so please CC
replies to me.

    Thanks,
      Mark

_______________________________________________
https://lists.gnu.org/mailman/listinfo/libtool

Reply via email to