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

Rolf Turner r@turner @end|ng |rom @uck|@nd@@c@nz
Sat Aug 25 01:20:09 CEST 2018

See in-line below.

On 08/25/2018 01:10 AM, Ista Zahn wrote:

> On Thu, Aug 23, 2018 at 6:57 AM Rolf Turner <r.turner using auckland.ac.nz> wrote:
>> I *think* that this is an R question (and *not* an RStudio question!)
> I think this is actually and Ubuntu question, and probably belongs on
> R-sig-debian.

Well, it's about installing R --- *could* be independent of OS.

>> I have, somewhat against my better judgement, decided to experiment with
>> using RStudio.
>> I downloaded and install RStudio.  Easy-peasy.  Nice lucid instructions.
>> 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?
>> Oops, no, I guess it wasn't.  So I carefully did a
>>       sudo make uninstall
>>       make clean
>>       make distclean
>> and then did
>>       ./R-3.5.1/configure <various flags>
>> making sure I added the --enable-R-shlib flag.
>> Then I did make and sudo make install.
> IMO if you are compiling and installing software yourself on Linux
> your are Doing It Wrong. Use the package manager, that is what it is
> there for.

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

I have been told by younger and wiser heads that installing from source 
is The Right Thing to Do.  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.  However, given that the 
suggestion had been made, I decided I'd try it.

The process for installing R using the package manager is far from 
straightforward and few people give clear instructions on this issue.
(Instructions are usually incomplete and full of jargon and acronyms 
that the instructors blithely assume assume that the instructees 
understand.  (They *don't*! In this instance (mirabile dictu!) I managed 
(using Uncle Google) to find very clear and explicit instructions at:


I followed these instructions, and everything went swimmingly.  I indeed 
got the current version of R (3.5.1, "Feather Spray").  So my previous 
impression was incorrect (given that one carefully follows the rather 
complex installation procedures, at least).

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

I then tried issuing the command:


Exactly the same pop-up error.  No help at all, as I expected.

I then tried

     sudo apt install r-base-dev

thinking that this might be needed to get the libR.so created (in the 
right place).  No joy.

I then tried the symlink strategy that I had previously suggested.  No 
joy there either.

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

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

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



> --Ista
> 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.
>> 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.
>> Can anyone explain to me WTF is going on?
>> What should I do?  Just make a symbolic link from /usr/lib/R/lib/libR.so
>> to /usr/lib64/R/lib/libR.so?
>> It bothers me that /usr/lib/R/lib/libR.so was not "refreshed" from my
>> most recent install of R.
>> I plead for enlightenment.
>> cheers,
>> Rolf Turner
>> P.S. I'm running Ubuntu 18.04.  And the previous install of R was done
>> under Ubuntu 18.04.
>> R. T.
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

More information about the R-help mailing list