1

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
John Polo
  • 547
  • 1
  • 8
  • 25
  • 1
    What about this? https://stackoverflow.com/questions/49458128/libgdal-so-20-issue-centos-rgdal#comment85943202_49458128 – Roman Luštrik Feb 25 '20 at 18:06
  • @RomanLuštrik thanks for suggestion. I tried what using what the OP said worked for them and it led to me coming across a few errors, most of which I fixed, but now I'm stuck with the last error. – John Polo Feb 25 '20 at 18:37
  • 3
    I don't know for R but when installing gdal wrapper in Python with pip there is a general rule that the wrapper version must match your system gdal version. Otherwise, the installation doesn't work. So for your gdal version, only Python package `gdal==2.4.4` could be installed. This indicates that different gdal versions are not very compatible with each other. So maybe the solution is to try some different combinations of system gdal and rgdal package versions. – AleksMat Feb 27 '20 at 15:53
  • @AleksMat ahh... okay. That makes sense. I'll have to see what versions of the software I can get in slackware. I know I can get various versions of GDAL. I don't know about different versions of rgdal or R(easily). – John Polo Feb 27 '20 at 23:27
  • Why don't you try slackbuild script: https://slackbuilds.org/repository/14.2/academic/R/ ? – DevilaN Apr 23 '20 at 11:34

0 Answers0