【问题标题】:"recipe for target 'projectit.o' failed" while installing rgdal安装 rgdal 时“目标 'projectit.o' 的配方失败”
【发布时间】:2020-11-24 10:43:47
【问题描述】:

在 R 中安装 rgdal_1.5-15 时出现以下错误(我在 Ubuntu 18.04.4 LTS GNU/Linux 4.15.0-112-generic x86_64 上):

projectit.cpp:159:6: error: conflicting declaration of C function ‘SEXPREC* transform_ng(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP)’
SEXP transform_ng(SEXP fromargs, SEXP toargs, SEXP coordOp, SEXP npts, SEXP x, SEXP y, SEXP z SEXP aoi) {
  ^~~~~~~~~~~~
In file included from projectit.cpp:11:0:
rgdal.h:132:6: note: previous declaration ‘SEXPREC* transform_ng(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP)’
SEXP transform_ng(SEXP fromargs, SEXP toargs, SEXP coordOp, SEXP npts, SEXP x, SEXP y, SEXP z, SEXP aoi); // both
  ^~~~~~~~~~~~
/usr/lib/R/etc/Makeconf:176: recipe for target 'projectit.o' failed
make: *** [projectit.o] Error 1
ERROR: compilation failed for package ‘rgdal’

我通过安装旧版本 (rgdal_1.4-8) 解决了这个问题。这对我来说似乎是一个错误,但我找不到提交错误报告的存储库(他们的 github 是只读的)。如有任何帮助,我们将不胜感激。

【问题讨论】:

  • rgdal2 作为一种解决方法有用吗?例如if (packageVersion("devtools") < 1.6) { install.packages("devtools") } devtools::install_github("thk686/rgdal2")?根据这个issue,您应该尝试install.packages("rgdal", repos="http://R-Forge.R-project.org") 和/或您可以从似乎维护C++ 绑定的@rsbivand 那里获得一些帮助
  • 我也是。您可以发送电子邮件给维护者 (maintainer("rgdal"))。在 r-forge r-forge.r-project.org/projects/rgdal r-forge.r-project.org/scm/?group_id=884 有一个 SVN 存储库,但没有明显的邮件列表。
  • 如果其他信息有助于回答这个问题,我在我的 Travis CI 版本之一(log filebuild file
  • 刚刚在同一个系统上对我来说完全一样。我没有找到解决办法..
  • 你在 Ubuntu 上的 GDAL 版本是什么?即在终端中使用以下命令:gdalinfo --version

标签: r rgdal


【解决方案1】:

更新: rgdal 1.5-16 已发布,其中包含针对 Ubuntu 18.04 的修复程序。仍然建议升级 GDAL 和 PROJ(如果可能),新版本可以从UbuntuGIS 获得或直接从源代码构建。

原始答案:我就这个错误联系了 rgdal 维护人员,他们表示这是针对过时版本的 GDAL 和 PROJ 构建 rgdal 时的一个已知问题。要解决该错误,他们建议通过运行安装包的开发版本:

install.packages("rgdal", repos="http://R-Forge.R-project.org")

Ubuntu 18.04 目前有 GDAL 2.2.3 和 PROJ 4.9.3。根据rgdal page on CRAN 的说法,rgdal 仍应与这些版本的 GDAL 和 PROJ 一起使用,但与这两个软件包的上游版本相比,它们已经过时了。 rgdal 维护者强烈建议运行最新版本的 GDAL 和 PROJ,以便利用最新的修复、改进和 API 更改。

【讨论】:

    【解决方案2】:

    这个问题现在通过 CRAN 上新版本的 rgdal_1.5-16 得到解决。

    https://twitter.com/RogerBivand/status/1291622288211750913?s=20

    【讨论】:

    • 是的,这为我解决了!除了等待更新,无需做任何事情。
    猜你喜欢
    • 2016-03-10
    • 2017-05-17
    • 2017-08-16
    • 2017-02-27
    • 2022-07-14
    • 2018-01-20
    • 1970-01-01
    • 2019-01-10
    • 1970-01-01
    相关资源
    最近更新 更多