[R] R seems to mangle LD_LIBRARY_PATH

Ross Boylan ross at biostat.ucsf.edu
Wed Mar 12 07:12:16 CET 2014


On Wed, 2014-03-12 at 18:30 +1300, Rolf Turner wrote:
> Can't hazard a guess as to why R is tacking on those other components to 
> LD_LIBRARY_PATH but it seems that if you use Sys.setenv() from within R 
> you can put your personal directory first. Something like:
> 
> Sys.setenv(LD_LIBRARY_PATH=paste("~/install/lib",
>                             Sys.getenv("LD_LIBRARY_PATH"),sep=":"))
> 
> You could put that line into your .Rprofile so that you wouldn't need to 
> enter it on each startup.
> 
> HTH
> 
> cheers,
> 
> Rolf Turner

That helps some; lsof now indicates the R has both the versions
in /usr/lib/openmpi and ~/install of libmpi.so, libopen-pal.so, and
libopen-rte.so.

Does anyone know how to tell which version it actually is using?  The
libraries are different versions.

The library that it is picking up isn't on LD_LIBRARY_PATH, and so I
think something else is going on.  Specifically, if I library("Rmpi")
and do lsof on the process I see (among other things)
R       17538 ross  txt    REG                8,1     5648   3058294 /usr/lib/R/bin/exec/R
R       17538 ross  mem    REG                8,1   335240   3105336 /usr/lib/openmpi/lib/libopen-pal.so.0.0.0
R       17538 ross  mem    REG                8,1   304576   3105337 /usr/lib/openmpi/lib/libopen-rte.so.0.0.0
R       17538 ross  mem    REG                8,1   679992   3105332 /usr/lib/openmpi/lib/libmpi.so.0.0.2
R       17538 ross  mem    REG              254,2  2802579 152045867 /home/ross/install/lib/libmpi.so.1.3.0
R       17538 ross  mem    REG              254,2   106626 152046481 /home/ross/Rlib-3.0.1/Rmpi/libs/Rmpi.so

BTW, ldd on the rmpi.so above gives (among other things)
       libmpi.so.1 => /home/ross/install/lib/libmpi.so.1 (0x00007ff609d68000)
and neither it nor ldd libmpi.so (my personal version) have references to /usr/lib/openmpi.

Rmpi.so does reference some of the libraries in /usr/lib/openmpi.  ldd mentions
        libopen-rte.so.7 => /home/ross/install/lib/libopen-rte.so.7 (0x00007ff608d07000)
but not libopen-pal

I believe the paths indicated by ldd are simply hints to the dynamic loader about where to look.

BTW, Rmpi was installed with

R CMD INSTALL Rmpi --configure-args='--with-Rmpi-include=/home/ross/install/include --with-Rmpi-libpath=/home/ross/install/lib --with-mpi=/home/ross/install --with-Rmpi-type=OPENMPI'

Maybe the --with-mpi path needs a /lib.

Ross
> 
> 
> On 12/03/14 16:00, Ross Boylan wrote:
> 
> > I am trying to ensure that a directory is searched first, but it gets
> > stuck at the end of LD_LIBRARY_PATH:
> >
> > $ export LD_LIBRARY_PATH=~/install/lib
> >
> > $ R
> >
> > R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"
> > Copyright (C) 2013 The R Foundation for Statistical Computing
> > Platform: x86_64-pc-linux-gnu (64-bit)
> > # banner omitted
> >
> >> Sys.getenv(c("PATH", "LD_LIBRARY_PATH"))
> >
> > PATH
> >
> > "/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
> >
> > LD_LIBRARY_PATH
> > "/usr/lib64/R/lib:/usr/lib/jvm/java-6-openjdk/jre/lib/amd64/server:/home/ross/install/lib"
> >>
> >
> >
> > I've seen some reference to $R_HOME/etc/ldpaths but I don't have access
> > to system files, and I definitely don't want this visible to other
> > users.
> >
> > I ran into this under Open MPI, but the previous example didn't use MPI
> > at all.
> >
> > I'm picking up the wrong libraries; what do I need to do so that my
> > personal library is searched first?
> >
> >
> > Running Debian squeeze.
>




More information about the R-help mailing list