Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R: Error in dyn.load(file, DLLpath = DLLpath, ...)

Tags:

c++

r

g++

ubuntu

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?

like image 949
j91 Avatar asked Aug 14 '16 15:08

j91


2 Answers

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
like image 131
Luís de Sousa Avatar answered Sep 19 '22 14:09

Luís de Sousa


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...

like image 38
Johann Horvat Avatar answered Sep 18 '22 14:09

Johann Horvat