[R] R shared library (/usr/lib64/R/lib/libR.so) not found.

Berwin A Turlach berw|n@tur|@ch @end|ng |rom gm@||@com
Thu Aug 23 16:04:42 CEST 2018


G'day Rolf,

On Thu, 23 Aug 2018 22:57:35 +1200
Rolf Turner <r.turner using auckland.ac.nz> wrote:

> I *think* that this is an R question (and *not* an RStudio question!)

Others may disagree... :)

> I have, somewhat against my better judgement, decided to experiment
> with using RStudio.

Very good if you are still involved with teaching and need to use the
same environment as your student...  or want to try some new IDE...

If you have a good set-up that works for you, a bit more difficult to
see why you want to change...  RStudio's editor  allegedly has an Emacs
style but I find that style more confusing than helpful... half of the
short-cuts do not seem to work...  

But it is a nice IDE...

> Then I tried to start RStudio ("rstudio" from the command line)
> and got a pop-up window with the error message:
> 
> > R shared library (/usr/lib64/R/lib/libR.so) not found. If this
> > is a custom build of R, was it built with the --enable-R-shlib
> > option?  

Yes, I regularly got that too, until I changed my R installation
scripts ....
 
> Oops, no, I guess it wasn't.  So I carefully did a
> 
>      sudo make uninstall
>      make clean
>      make distclean

To bad that you did this.  There should have been a file called
"config.log" in that directory, and the top lines of that file would
have told you with which option ./configure was called, in particular
whether you had used the --enable-R-shlib flag.

> and then did
> 
>      ./R-3.5.1/configure <various flags>
> 
> making sure I added the --enable-R-shlib flag.

Well, some of the other flags might also be important...

> Then I did make and sudo make install. It all seemed to go ...
> but then I did
> 
>      rstudio
> 
> again and got the same popup error.
> 
> There is indeed *no* libR.so in /usr/lib64/R/lib.

I wonder why rstudio tries to look into /usr/lib64.  AFAICT, rstudio
queries the R that it uses for its home directory and then expects
libR.so to be at a specific location relative to this home directory.
And it expects that the installation does not use sub-architectures,
that is what tripped me up.  

> There *is* a libR.so in /usr/lib/R/lib, but (weirdly) ls -l reveals
> that it dates from the my previous install of R-3.5.1 for which I
> *did not* configure with --enable-R-shlib.

Are you sure?  I am running Ubuntu 18.04 too.  My system
has /usr/lib/libR.so and /usr/lib/R/lib/libR.so, with the former being
a link to the latter.  And these were installed via `r-base-core` which
seems to be a requirement for `ess`.  (The long list of `ess` on
Ubuntu, together with its insistence of installing r-base-core and a
whole bunch of r-cran-* package is IMHO ridiculous.   Nearly bad enough
to make me consider installing ESS from source again.)

So the /usr/lib/R/lib/libR.so could be from r-base-core (if you somehow
installed that package).

Obviously you have sudo rights on your machine, so I would suggest to
try:
	sudo updatedb
	locate libR.so
To see how many libR.so you have installed and where they are
 
> Can anyone explain to me WTF is going on?

Not with much more information, e.g. what those "<various flags>"
to .configure were.  

Also, the great strength of unix system is that you can influence the
behaviour of programs via system variables...  unfortunately that is
also one of its greatest weaknesses when it comes to finding out why
programs do not behaved the way you expect them to work.  Some stray
environment variable might cause all this problem.

> What should I do?  Just make a symbolic link
> from /usr/lib/R/lib/libR.so to /usr/lib64/R/lib/libR.so?

I would not recommend this.  If this file is from another installation,
you are just asking for trouble down the road, which would then be even
harder to debug.

> It bothers me that /usr/lib/R/lib/libR.so was not "refreshed" from my
> most recent install of R.

Me too.  But I think you should never install to this location in the
first place.  AFAICT, /usr/lib/R/lib/libR.so is installed by
r-core-base, so if you install your own version there and then a
"apt-get update" updates r-core-base, you will end up with a broken
system.   

I learned the hard way long time ago not to install any software in
areas where Ubuntu packages are installed.  I restrict myself to
install to /usr/local or /opt (with /opt often being on a separate
partition so that material installed there survive if I have to
install/upgrade Ubuntu from scratch).

> I plead for enlightenment.

Not sure whether my comments were very helpful.  But you should
probably find out why your custom installed version of R tells RStudio
to look at /usr/lib64. A "locate libR.pc" could be helpful.  on my
system this returns /usr/lib/pkgconfig/libR.pc (from r-base-core)
and /opt/R/R-3.5.1/lib/pkgconfig/libR.pc (my installation from source).

Cheers,

	Berwin




More information about the R-help mailing list