“recipe for target 'projectit.o' failed” while installing rgdal

喜欢而已 提交于 2021-02-08 14:01:43

问题


I am getting the following error while installing rgdal_1.5-15 in R (I am on a 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’

I solved this issue by installing an older version (rgdal_1.4-8). This looks like a bug to me, but I could not find a repository to submit a bug report to (their github is read-only). Any help on finding one would be appreciated.


回答1:


Update: rgdal 1.5-16 has been released with a fix for Ubuntu 18.04. Upgrading GDAL and PROJ (if possible) is still recommended, and new versions can be obtained from UbuntuGIS or built from source directly.

Original answer: I contacted the rgdal maintainers about this error and they indicated that it is a known issue when building rgdal against out-of-date versions of GDAL and PROJ. To work around the error, they recommend installing a development version of the package by running:

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

Ubuntu 18.04 currently has GDAL 2.2.3 and PROJ 4.9.3. According to the rgdal page on CRAN, rgdal should still work with these versions of GDAL and PROJ, but they are far out of date compared to the upstream versions of both packages. The rgdal maintainers strongly recommend running the latest versions of GDAL and PROJ in order to take advantage of the latest fixes, improvements, and API changes.




回答2:


This issue is now solved with the new release of rgdal_1.5-16 on CRAN.

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



来源:https://stackoverflow.com/questions/63245141/recipe-for-target-projectit-o-failed-while-installing-rgdal

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!