1

堆栈上已经有很多这样的问题......我发现了很多,但它并没有解决我的问题。

这些是我迄今为止尝试过的事情。访问 CRAN 网站 cran.r-project.org/web/packages/rgdal/index.html

我们看到为了构建这个包,我们需要

  • GDAL >= 1.6.3,来自 trac.osgeo.org/gdal/wiki/DownloadSource 的库和
  • 来自 download.osgeo.org/proj/ 的 PROJ.4 (proj >= 4.4.9); 

此外,我们需要依赖项

  • 取决于:R (≥ 3.3.0)、方法、sp (≥ 1.1-0)

但是这些已经安装好了。

我们已经安装了系统依赖项,因为

[]$ gdal-config --version
2.1.3
[]$ proj
Rel. 4.4.9, 29 Oct 2004
usage: proj [ -beEfiIlormsStTvVwW [args] ] [ +opts[=arg] ] [ files ]

但是,当我们尝试通过

install.packages("rgdal_1.2-5.tar.gz",type = "source",repos = NULL,
configure.args=c('--with-proj-include=/usr/local/include','--with-proj-lib=/usr/local/lib'))

configure.args 选项来自 rgdal 包安装中给出的答案

但是我们在安装时仍然收到错误...这是日志的一部分

    *** installing help indices
      converting help for package ‘rgdal’
        finding HTML links ... done
        CRS-class                               html
        GDALDataset-class                       html
        GDALDriver-class                        html
        GDALMajorObject-class                   html
        GDALRasterBand-class                    html
        GDALReadOnlyDataset-class               html
        GDALReadOnlyDataset-methods             html
        GDALTransientDataset-class              html
        GridsDatums                             html
        RGB2PCT                                 html
        SGDF2PCT                                html
        SpatialGDAL-class                       html
        closeDataset-methods                    html
        displayDataset                          html
        llgrid                                  html
    Rd warning: /tmp/RtmppvlZ6x/R.INSTALL233feb7dc50/rgdal/man/llgrid.Rd:11: missing file link ‘Spatial’
    Rd warning: /tmp/RtmppvlZ6x/R.INSTALL233feb7dc50/rgdal/man/llgrid.Rd:16: missing file link ‘gridat’
    Rd warning: /tmp/RtmppvlZ6x/R.INSTALL233feb7dc50/rgdal/man/llgrid.Rd:17: missing file link ‘gridat’
        make_EPSG                               html
        nor2k                                   html
        projInfo                                html
        project                                 html
        readGDAL                                html
    Rd warning: /tmp/RtmppvlZ6x/R.INSTALL233feb7dc50/rgdal/man/readGDAL.Rd:136: missing file link ‘flipVertical’
        readOGR                                 html
        showWKT                                 html
        spTransform-methods                     html
        wrappers                                html
        writeOGR                                html
    ** building package indices
    ** installing vignettes
    ** testing if installed package can be loaded
    Error in dyn.load(file, DLLpath = DLLpath, ...) :
      unable to load shared object '/usr/lib64/R/library/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 ‘/usr/lib64/R/library/rgdal’
    Warning message:
    In install.packages("rgdal_1.2-5.tar.gz", type = "source", repos = NULL) :
      installation of package ‘rgdal_1.2-5.tar.gz’ had non-zero exit status

请注意,此处触发的警告显然没有显示停止器(如https://groups.google.com/forum/#!topic/batchjobs/TvwTbqrWFyU上所说)所以似乎系统依赖项(GDAL 和 PROJ)是两者都满足...包依赖项(方法,sp)也在那里。但是,安装无法定位某些文件。我从 stackoverflow 知道,这样您就可以为 R 的 install.packages() 命令提供某些参数...如上面的代码片段所示。所以它可能是我没有指定足够的路径......或者它的其他东西

Atlast,旧edgenode上gdal和proj的位置由下式给出

  • gdal:/usr/local/lib/libgdal.so.20
  • 项目:/usr/local/lib/libproj.so.0 11:26:32

你们能告诉我从这里去哪里吗?

4

1 回答 1

0

我遇到了同样的问题,在 Ubuntu 的另一个线程中,答案是 rgdal-config 给出了两个安装点,这是错误的,所以他卸载了一个。在另一个线程上,解决方案是安装 libgdal-dev,因为它们需要从源代码安装。

我在 Arch Linux 上,所以这些都不是我的答案。

不过,我确实发现对于 libgdal-dev,AUR 包“python-gdal”为我提供了所需的 deps,但关键是 rgdal 的可选依赖项(对我来说安装没有问题)是 mariadb。在错误中,您可以看到它无法与 mysql_client18 通信。

所以我安装了 maria db,sudo pacman -S mariadb我终于可以为 R 安装 r-cran-gdal。用于 r-cran-gdal 的 PKGBUILD 在 AUR 上不是最新的,但手动编辑 PKGBUILD 和 makepkg -si 终于奏效了。

于 2018-02-10T22:56:40.707 回答