unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Bruce Korb <bkorb@gnu.org>
To: "Ludovic Courtès" <ludo@gnu.org>,
	"Guile Development" <guile-devel@gnu.org>
Subject: Re: Why is Guile now setting LD_LIBRARY_PATH?
Date: Tue, 11 Sep 2012 09:21:27 -0700	[thread overview]
Message-ID: <CAKRnqNJ+5t5X6sh85Z9WmGGy8m7N=ZBR7c8vFNnE+-4FpEV20A@mail.gmail.com> (raw)

Hi Ludo,
>> in main() LD_LIBRARY_PATH='EMPTY'
>> in inner_main() LD_LIBRARY_PATH='/usr/lib64:/usr/lib64/guile/2.0/extensions'
>
>The reason provided in ‘sysdep_dynl_init’ is:
>
>/* Add SCM_LIB_DIR and ... See
>   <http://lists.gnu.org/archive/html/guile-devel/2010-11/msg00095.html>
>   for details. */

I am sure you are not arguing that I ought to have known due to a comment
in source code and an email from a couple of years ago.  My point is that
messing with the library search path in an effectively secret manner
caused me to spend hours chasing the problem.

>> libguile needs to be linked with -Wl,-rpath
>> -Wl,/usr/lib64/guile/2.0/extensions
>> instead of messing up your client's link/load. ("/usr/lib64" should not be
>> needed.)
>
>Problem is that (1) -rpath is not always available, and (2) when using
>GNU ld with --enable-new-dtags, it produces a RUNPATH (not an RPATH),
>which can be overridden by $LD_LIBRARY_PATH.
>
>I agree that using setenv is ugly, but finding an option that’s portable
>and doesn’t break existing programs seems tricky too.
>
>Do you have any solutions meeting this criteria in mind?

Wrap your dlopen's in code that pushes the needed values to the environment
and then removes them when dlopen is done.  You still have multi-thread
issues when someone is calling dlopen or exec while a libguile thread
is messing with the environment.  Perhaps you could document a global
lock variable that could single-thread these operations for multi-threaded
applications.  Either way, fiddling the environment only while using dlopen
is far better than breaking people's applications in unexpected ways.

At the end:  messing with LD_LIBRARY_PATH in a library breaks programs
that use the library and make calls to exec or dlopen.  Please find
a solution that does not do this, or at least minimizes the issues.

Thank you.  Regards, Bruce

C.F. Greg Troxel:
> I don't follow why you think this is the right fix.  It seems that guile
>  (main) and libguile (library) should both not set LD_LIBRARY_PATH at
> all.
To be clear, I do not think this the right fix, but since my application has to
cope with un-fixed guile releases, I have to do something.  Nuking the
variable is the easiest.   WRT guile the program and libguile the library, you
are correct:  neither should set LD_LIBRARY_PATH.  It needs to be a
user selection to adjust to specific issues in a user's environment.



             reply	other threads:[~2012-09-11 16:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-11 16:21 Bruce Korb [this message]
2012-09-13 23:30 ` Why is Guile now setting LD_LIBRARY_PATH? Bruce Korb
2012-09-14 18:06   ` Mark H Weaver
  -- strict thread matches above, loose matches on Subject: below --
2012-09-10 23:48 Bruce Korb
2012-09-11  0:08 ` Bruce Korb
2012-09-11  1:59   ` Greg Troxel
2012-09-11 13:12 ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKRnqNJ+5t5X6sh85Z9WmGGy8m7N=ZBR7c8vFNnE+-4FpEV20A@mail.gmail.com' \
    --to=bkorb@gnu.org \
    --cc=guile-devel@gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).