Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"recipe for target 'projectit.o' failed" while installing rgdal

Tags:

r

rgdal

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.

like image 634
ze miguel Avatar asked Aug 04 '20 10:08

ze miguel


2 Answers

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.

like image 100
Arnon Avatar answered Oct 21 '22 19:10

Arnon


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

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

like image 28
ze miguel Avatar answered Oct 21 '22 20:10

ze miguel