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

Berwin A Turlach berw|n@tur|@ch @end|ng |rom gm@||@com
Sat Aug 25 16:59:18 CEST 2018

G'day Rolf,

On Sat, 25 Aug 2018 11:20:09 +1200
Rolf Turner <r.turner using auckland.ac.nz> wrote:

> I was pretty sure that the foregoing was a complete red herring.  And
> I was right.

I am not sure whether I agree. :)
> I have been told by younger and wiser heads that installing from
> source is The Right Thing to Do. 

Younger heads probably have more time on their hands to play around
with installing from source and debugging when things go wrong.  Wiser
heads probably have figured out how they should do so in the first
place. :)

Seriously, years ago I installed quite a bit of software from source,
also to always have the newest version.  And while I was using Debian
unstable I accepted that from time to time an update would leave me
with a broken system and I would have to spend some time to fix it
again.  Nowadays, I rather spend my time on other things and so am
happy to go with most software with whatever version the package
installer of Ubuntu installs.

The one exception is R, but that is for various good reasons:
  * I want to have the 32 bit and 64 bit architecture installed so
    that I can test my packages on both packages.  
  * I would like to keep old versions around, to test my packages on
  * I like to use the R version that is installed in our computer
    lab when preparing teaching material, and the newest version

If I ever get the feeling that all these points are easily achievable
with the compiled packages (without having to play around with docker,
sandboxes etc), I would stop compiling R from source.

> Moreover I'd always had the impression that the version of R provided
> by the package manager persistently lags one or two releases behind
> the current version.

From the official repositories, yes.  But CRAN provides since longer
than I can remember up-to-date binary packages for the most common
Linux distributions.  AFAIK, Debian and Ubuntu packages are available
thanks to Dirk Eddelbuettel (initially? mainly?) and others.

> The process for installing R using the package manager is far from 
> straightforward and few people give clear instructions on this issue.

1.) Start a web browser
2.) Go to your favourite CRAN server
3.) Select 'Download R for Linux'
4.) Select the directory "ubuntu/" from the page that is served
5.) Select README.html from the page that is served
6.) Follow the instructions

> (Instructions are usually incomplete and full of jargon and acronyms 
> that the instructors blithely assume assume that the instructees 
> understand.  

I am sure (some) of my students have the same complains about my

> (They *don't*! In this instance (mirabile dictu!) I managed (using
> Uncle Google) 

You were lucky in this case, usually Uncle Google serves me with
somewhat out-dated (if not wrong) information when I run into a
technical problem with linux.....

> to find very clear and explicit instructions at:
> https://www.digitalocean.com/community/tutorials/how-to-install-r-on-ubuntu-18-04-quickstart
> I followed these instructions, and everything went swimmingly. 

You were lucky that you are not sitting behind a firewall (as I seem to
be, not sure whom I have to thank for that).  For me the first step
(installing the GPG key) fails and some further googling was
necessary.  Though, I was working from the CRAN instructions.

> Interestingly (???) the "new" R was installed in /usr/bin and not in 
> /usr/local/bin.

Of course, it is a system Ubuntu package, so it installs to /usr/bin.

> I then tried issuing the command:
>      rstudio
> Exactly the same pop-up error.  No help at all, as I expected.

O.k., as I got a new machine, I installed (X)ubuntu 18.04 from scratch,
no update from an earlier version.  The R version installed from
r-base-core was R 3.4.4.  In a terminal in which I manipulated my PATH
variable so that /usr/bin is early on, I could start R without problem,
and I could start rstudio without problem.

After following the instructions on CRAN and updating my apt
information, I have now R 3.5.1 installed.  And it starts fine from the
command line as does rstudio.  And rstudio starts now with R 3.5.1.

Both these packages work out of the box.  Thus I wonder whether you
have somehow messed up your system during the attempt to install R from
source.  Or have some environment variables set that provide rstudio
with wrong information....

> Then finally, in desperation, I copied libR.so from /usr/lib/R/lib to
> /usr/lib64/R/lib.  Bingo!!!  I can now start Rstudio!!!

I keep wondering why you have a /usr/lib64.

On my Ubuntu boxes, in /usr I have /lib, /lib32 and /libx32, but no
lib64.  As far as I know, Debian/Ubuntu 64bit implementations always
used /usr/lib for its 64 bit libraries and /usr/lib32 for the 32 bit
versions (unlike other distributions who used /usr/lib64 for the former
and /usr/lib for the latter).

In fact, a 'locate /lib64' on my Ubuntu 18.04 system (less than 2 week
old fresh installation) shows:


So there seems to be a /lib64, but no /usr/lib64.  How did you get
this?  And why does rstudio think it has to look into that directory?

> It remains mysterious to me why the symlink procedure did not work, 
> whereas making a copy of libR.so *did* work.

Agreed, that is somebody a mystery.

> However I guess this really doesn't matter.  It's now working.

Until it breaks again. :)

I would advise to start at some point with a clean Ubuntu installation,
and then restrict yourself to /usr/local and /opt when installing
software from source.  



More information about the R-help mailing list