13

I have worked now for some time on an R project in my office's desktop computer, but need to carry the scripts with me while on travel. I copied everything into my laptop and did some changes to the code. Alas, when trying to compile (following the exact same procedure I was using in my desktop computer), the following error:

$ R CMD INSTALL --no-multiarch --with-keep.source coala
* installing to library ‘/home/my_pc/R/x86_64-pc-linux-gnu-library/3.3’
* installing *source* package ‘coala’ ...
** libs
make: Nothing to be done for `all'.
installing to /home/my_pc/R/x86_64-pc-linux-gnu-library/3.3/coala/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
unable to load shared object '/home/my_pc/R/x86_64-pc-linux-gnu-library/3.3/coala/libs/coala.so':
/home/my_pc/R/x86_64-pc-linux-gnu-library/3.3/coala/libs/coala.so: undefined symbol: _ZSt24__throw_out_of_range_fmtPKcz
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/my_pc/R/x86_64-pc-linux-gnu-library/3.3/coala’
* restoring previous ‘/home/my_pc/R/x86_64-pc-linux-gnu-library/3.3/coala’

Both computers have the same Ubuntu but different R version. Also, I have to mention that I am working in two libraries at the same time and that the accompanying library update without problems, which makes this error message more puzzling. I have checked answers that may be related to this question, but can't figure out how to apply their solutions:

R: error installing packages UBUNTU - Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared object Got message unable to load shared object stats.so when R starts

Is there a way to solve this problem? Which may be the cause? What is the undefined symbol _ZSt24__throw_out_of_range_fmtPKcz?

Community
  • 1
  • 1
j91
  • 451
  • 1
  • 4
  • 14

4 Answers4

5

I had a similar issue with rgdal on Ubuntu. Re-installing the package was enough to getting it working again.

$ sudo R
> install.packages("rgdal")
> quit()
$ exit
Luís de Sousa
  • 5,765
  • 11
  • 49
  • 86
3

What is .libPaths() giving you as the output?

I encountered the same problem using the latest update today (R 3.3.1 for MacOS X). My R installation seemed to crash after updating it. My solution was simply to remove the lib directories from the file system and reinstall R:

rm -rf /Users/johann/Library/R/3.3/library
sudo rm -rf Library/Frameworks/R.framework/Versions/3.3/Resources/library

Hope this helps...

Johann Horvat
  • 1,285
  • 1
  • 14
  • 18
0

The problem is the linkage with your g++ stdlib. Different versions of Ubuntu have different versions of g++ stdlib. You cant always copy binaries from one to the other.

You may fix this by recompiling R for the laptop, or using the Ubuntu R packages. e.g. http://packages.ubuntu.com/xenial/r-base

John Vandenberg
  • 474
  • 6
  • 16
-3

For Mac / Linux

  1. Press command + space
  2. Type terminal and press enter to open terminal. In terminal paste this open /Library/Frameworks/R.framework/Resources/library and press enter. A finder window should open with a lot of folders
  3. Each folder matches an installed R package.
  4. Delete them all, close RStudio, reopen RStudio and install the packages you need with install.packages("dplyr") etc

After I did this, the issue went away

stevec
  • 41,291
  • 27
  • 223
  • 311