1

我已经在 64 位 slackware v14.2-current 上安装了 R-3.6.1。我正在尝试安装 R 库 rgdal。我已经尝试从 R 中安装 install.packages("rgdal")

安装失败并出现以下错误:

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

我的GDAL安装:

bash-5.0$ gdalinfo --version
GDAL 2.4.4, released 2020/01/08

搜索 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

我试过了

install.packages('rgdal', type = "source", configure.args=c('--with-libgdal=/usr/local/lib/libgdal.so.26'))

不知道会发生什么。它失败并显示与上述相同的错误消息。

> 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 正在搜索 libgdal.so.20,我有 0.26,但没有 .20。我不知道如何,如果我应该,将install.packages()函数指向 v.26。如果脚本指向 0.26,它会起作用吗?如何让脚本指向较新版本的 libgdal.so?

编辑-在 Roman Luštrik 的评论之后,我复制了

cp /usr/local/lib/libgdal.so.26 /usr/lib64/
cp /usr/local/lib/libgdal.so /usr/lib64/

然后又试install.packages("rgdal")了一次。它再次失败并出现与第一次类似的错误消息,但现在它缺少“libproj.so.15”。因此,重复步骤:

cp /usr/local/lib/libproj.so /usr/lib64
cp /usr/local/lib/libproj.so.15 /usr/lib64

又试install.packages("rgdal")了一次。这次的错误是

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

再试install.packages("rgdal")一次。现在错误是:

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
4

0 回答 0