On Mon, 26 Mar 2007, ian white wrote:
> Dear R-help,
>
> I am trying to use a package (not from CRAN) which includes two shared
> library (.so) files. The maintainer suggests inserting two lines
> in /usr/bin/R,
>
> LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:path-to-package/lib
> export LD_LIBRARY_PATH
(Not a very good idea, not least because there is another copy at
R_HOME/bin/R. Better to modify R_HOME/etc/ldpaths, which deals with
setting LD_LIBRARY_PATH.)
> This works, but I felt more comfortable putting the first line
> in .Renviron or $R_HOME/etc/Renviron.site. However this doesn't seem to
> work, and I cannot see why it doesn't.
Those files are read by the process. You don't state your OS, but many
OSes make sure that the paths for dlopen are cached before the process has
a chance to change LD_LIBRARY_PATH, for security-related reasons. Most
OSes are silent about this, but Solaris says
If other objects were link-edited with pathname when path-
name was built, that is, the pathname has dependencies on
other objects, those objects will automatically be loaded by
dlopen(). The directory search path used to find both path-
name and the other needed objects may be affected by setting
the environment variable LD_LIBRARY_PATH, which is analyzed
once at process startup, and from a runpath setting within
the object from which the call to dlopen() originated.
As dlopen came from SunOS, it seems the behaviour has been copied by most
implementations of dlopen. (AFAICS it is not touched on by POSIX.)
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595