问题
I have AWS RHEL6 server where I've installed (compiled) rgdal 1.9.2 and proj packages. Now in R I want to install rgdal package but it gives this error:
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/home/Roel/R/x86_64-redhat-linux-gnu-library/3.3/rgdal/libs/rgdal.so':
libgdal.so.1: cannot open shared object file: No such file or directory Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/Roel/R/x86_64-redhat-linux-gnu-library/3.3/rgdal’ Warning in install.packages :
installation of package ‘rgdal’ had non-zero exit status
Full install log can be found here.
When I do locate rgdal.so in Linux it doesn't find anything. I can also not find how to get rgdal.so of what it is part of.
Has anyone any idea on how to fix this?
回答1:
I fixed it:
There is an error further up in the log as well that I had missed because of the error at the end:
./proj_conf_test: error while loading shared libraries: libgdal.so.1: cannot open shared object file: No such file or directory
libgdal.so.1 was on the system in /usr/local/lib.
I then did:
echo "/usr/local/lib" >> /etc/ld.so.conf.d/R-dependencies-x86_64.conf
ldconfig
This fixed the subsequent error that I mentioned in the OP.
回答2:
If you see Permission Denied when running Roel's, try:
sudo ldconfig -c "echo '/usr/local/lib' >> /etc/ld.so.conf.d/R-dependencies-x86_64.conf"
来源:https://stackoverflow.com/questions/40305095/cannot-install-rgdal-package-in-r-on-rhel6-unable-to-load-shared-object-rgdal-s