I have installed R-3.6.1 on 64 bit slackware v14.2-current. I am trying to install an R library, rgdal. I have tried the installation from within R with
install.packages("rgdal")
and
The installation fails with the error:
...
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘rgdal’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/home/user/R/x86_64-slackware-linux-gnu-library/3.6/00LOCK-rgdal/00new/rgdal/libs/rgdal.so':
libgdal.so.20: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/user/R/x86_64-slackware-linux-gnu-library/3.6/rgdal’
My GDAL installation:
bash-5.0$ gdalinfo --version
GDAL 2.4.4, released 2020/01/08
Search for libgdal:
bash-5.0$ locate libgdal.so
/usr/local/lib/libgdal.so
/usr/local/lib/libgdal.so.26
/usr/local/lib/libgdal.so.26.0.1
I tried
install.packages('rgdal', type = "source", configure.args=c('--with-libgdal=/usr/local/lib/libgdal.so.26'))
not having any idea what would happen. It failed with the same error message as above.
> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-slackware-linux-gnu (64-bit)
Running under: Slackware 14.2 x86_64 (post 14.2 -current)
Matrix products: default
BLAS: /usr/lib64/R/lib/libRblas.so
LAPACK: /usr/lib64/R/lib/libRlapack.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=C
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.6.1 tools_3.6.1 tcltk_3.6.1
R/rgdal is searching for libgdal.so.20 and I have .26, but no .20. I don't know how to, and if I should, point the install.packages()
function at v.26. Will it work if the script points at .26? How do I get the script to point to the newer version of libgdal.so?
EDIT-After the comment from Roman Luštrik, I copied
cp /usr/local/lib/libgdal.so.26 /usr/lib64/
cp /usr/local/lib/libgdal.so /usr/lib64/
Then tried install.packages("rgdal")
again. It failed again with a similar error message as first, except now it was missing "libproj.so.15". Thus, repeated steps:
cp /usr/local/lib/libproj.so /usr/lib64
cp /usr/local/lib/libproj.so.15 /usr/lib64
Tried install.packages("rgdal")
again. This time the error was
Error: proj/epsg not found
Either install missing proj support files, for example
the proj-nad and proj-epsg RPMs on systems using RPMs,
or if installed but not autodetected, set PROJ_LIB to the
correct path, and if need be use the --with-proj-share=
configure argument.
bash-5.0# export PROJ_LIB=/usr/share/proj
bash-5.0# echo $PROJ_LIB
/usr/share/proj
Try install.packages("rgdal")
again. Now the error is:
Error: package or namespace load failed for ‘rgdal’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/home/user/R/x86_64-slackware-linux-gnu-library/3.6/00LOCK-rgdal/00new/rgdal/libs/rgdal.so':
/home/user/R/x86_64-slackware-linux-gnu-library/3.6/00LOCK-rgdal/00new/rgdal/libs/rgdal.so:
undefined symbol: pj_get_ellps_ref