support for tmap via lwgeom package

Installation of package 'tmap' is failing due to some kind of compilation failure for package 'lwgeom.'

Here's the error message when one tries to install.packages('lwgeom'):

Installing package into ‘/home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.5’
(as ‘lib’ is unspecified)
trying URL 'http://package-proxy/src/contrib/lwgeom_0.1-5.tar.gz'
Content type 'application/x-gzip' length 441628 bytes (431 KB)
==================================================
downloaded 431 KB

* installing *source* package ‘lwgeom’ ...
** package ‘lwgeom’ successfully unpacked and MD5 sums checked
configure: CC: gcc
configure: CXX: g++
configure: pkg-config proj exists, will use it
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking proj_api.h usability... yes
checking proj_api.h presence... yes
checking for proj_api.h... yes
configure: PROJ: 4.9.2
checking for pj_init_plus in -lproj... yes
checking PROJ.4: epsg found and readable... yes
checking PROJ.4: conus found and readable... yes
checking for geos-config... /usr/bin/geos-config
checking geos-config usability... yes
configure: GEOS: 3.5.1
checking GEOS version >= 3.3.0... yes
checking geos_c.h usability... yes
checking geos_c.h presence... yes
checking for geos_c.h... yes
checking geos: linking with -L/usr/lib/x86_64-linux-gnu -lgeos_c... yes
checking for lwgeom_make_valid in -llwgeom... yes
checking for lwgeom_grid_in_place in -llwgeom... no
checking liblwgeom_internal.h usability... no
checking liblwgeom_internal.h presence... no
checking for liblwgeom_internal.h... no
configure: Package CPP flags:   -I/usr/include -DPOSTGIS_GEOS_VERSION=35 -DHAVE_LIBGEOM -DNO_GRID_IN_PLACE
configure: Package LIBS:  -lproj  -llwgeom
configure: creating ./config.status
config.status: creating src/Makevars
** libs
g++ -std=gnu++11 -I"/opt/R/3.5.2/lib/R/include" -DNDEBUG -I/usr/include -DPOSTGIS_GEOS_VERSION=35 -DHAVE_LIBGEOM -DNO_GRID_IN_PLACE -I"/home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -I"/home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.5/sf/include" -I/usr/local/include   -fpic  -g -O2 -c geodetic.cpp -o geodetic.o
g++ -std=gnu++11 -I"/opt/R/3.5.2/lib/R/include" -DNDEBUG -I/usr/include -DPOSTGIS_GEOS_VERSION=35 -DHAVE_LIBGEOM -DNO_GRID_IN_PLACE -I"/home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -I"/home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.5/sf/include" -I/usr/local/include   -fpic  -g -O2 -c lwgeom.cpp -o lwgeom.o
lwgeom.cpp: In function ‘Rcpp::LogicalVector CPL_is_polygon_cw(Rcpp::List)’:
lwgeom.cpp:232:46: error: ‘lwgeom_is_clockwise’ was not declared in this scope
     out[i] = lwgeom_is_clockwise(lwgeom_cw[i]);
                                              ^
/opt/R/3.5.2/lib/R/etc/Makeconf:171: recipe for target 'lwgeom.o' failed
make: *** [lwgeom.o] Error 1
ERROR: compilation failed for package ‘lwgeom’
* removing ‘/home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.5/lwgeom’
Warning in install.packages :
  installation of package ‘lwgeom’ had non-zero exit status

link to project: https://rstudio.cloud/project/180109

I don't envy y'all the hassle of getting all the GIS backends working on your servers to the point that they can run R's GIS packages...standard linux repositories just don't seem to have it together on GDAL, etc.

Seems like this issue might be related. Try installing lwgeom from GitHub until the next version makes it to CRAN.

1 Like

Tried

devtools::install_github("r-spatial/lwgeom")

and it worked!!!

(specifically, after the above, install.packages("tmap") worked!)

Thanks!

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.