From: Marius Vollmer <mvo@zagadka.ping.de>
Subject: Re: (dynamic-link) ignores PREFIX/lib and $LD_LIBRARY_PATH
Date: 18 Jun 2002 23:26:48 +0200 [thread overview]
Message-ID: <87hek046sn.fsf@zagadka.ping.de> (raw)
In-Reply-To: <m3adpsshgc.fsf@multivac.cwru.edu>
prj@po.cwru.edu (Paul Jarc) writes:
> I have guile 1.4.1 installed in an unusual place, so PREFIX/lib
> isn't in the usual search path for shared libraries. It seems guile
> should always search PREFIX/lib, preferably before the systemwide
> directories and after those listed in $LD_LIBRARY_PATH. (Actually,
> it should search all the -rpath directories that the binary was
> linked with, which should (and does) include PREFIX/lib.)
The best way to get around this, in my opinion, is to add PREFIX/lib
to the usual search path, system wide (or user wide).
Having a per-application or per-library search path will lead to a
hard to understand system, I'd say. It is better to configure your
system so that there is one single shared library namespace. Of
course, this namespace can also be configured per-user, or a user
might have multiple such namespaces that he switches between, but
making a program switch to a different namespace is likely not really
helpful in the end.
Configuring a Unix system for installation prefixes beyond /, /usr,
and /usr/local is not something that a program should attempt to do on
its own and behind the back of the sysadmin.
> When I evaluate (use-modules (ice-9 readline)), guile search only
> /lib when looking for libguilereadline.so (not even /usr/lib). If I
> set $LD_LIBRARY_PATH to include PREFIX/lib, then guile looks there
> first and finds it, but keeps looking anyway and still fails:
>
> access("/package/host/localhost/guile-1.4.1-1/lib/libguilereadline.so", R_OK) = 0
Holy shamoly, this is a bug in libltdl (the portable dlopen wrapper
that Guile uses).
When libltdl opens a ".so" file, it uses access to test for file
readability, but it gets the interpretation of the return value wrong!
static int
find_handle_callback (filename, data, ignored)
char *filename;
lt_ptr data;
lt_ptr ignored;
{
lt_dlhandle *handle = (lt_dlhandle *) data;
int found = access (filename, R_OK);
/* Bail out if file cannot be read... */
if (!found)
return 0;
/* Try to dlopen the file, but do not continue searching in any
case. */
if (tryall_dlopen (handle, filename) != 0)
*handle = 0;
return 1;
}
As you can see, access is supposed to return non-zero for a readable
file, but it does of course return zero in this case. I'd also say
that it should use F_OK instead of R_OK since we only want to know
whether it exists. Missing r bits should be reported when trying to
read it.
When opening a ".la" file, libltdl uses fopen to test for 'existence'.
Guile 1.5.6 links "libguilereadline" and relies on libltdl to supply
the right extension (which will be ".la"). Guile 1.4.1 explicitely
links "libguilereadline.so" and thus triggers the bug.
You can check this by executing
(dynamic-link "libguilereadline")
and
(dynamic-link "libguilereadline.so")
CVS libtool has a fix for this, but it's not in a released version as
far as I know. We'll make sure that 1.6 will be released with a good
libltdl.
Thanks for the report!
_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-guile
prev parent reply other threads:[~2002-06-18 21:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-06-18 16:02 (dynamic-link) ignores PREFIX/lib and $LD_LIBRARY_PATH Paul Jarc
2002-06-18 17:57 ` Paul Jarc
2002-06-18 18:13 ` Thien-Thi Nguyen
2002-06-18 18:01 ` Thien-Thi Nguyen
2002-06-18 18:13 ` Paul Jarc
2002-06-18 18:37 ` Thien-Thi Nguyen
2002-06-18 21:26 ` Marius Vollmer [this message]
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=87hek046sn.fsf@zagadka.ping.de \
--to=mvo@zagadka.ping.de \
/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).