[R] rgdal installation with two versions of GDAL

Rob Skelly rob at dijital.ca
Wed Apr 22 06:43:19 CEST 2015


Hello,

I am using GDAL 2.0 for most of my work, but rgdal depends on GDAL < 2. I
have built and installed GDAL 1.11.2 in /opt/gdal-1.11.2, and rgdal
compiles and installs into R, using the following command:

sudo R CMD INSTALL
--configure-args="--with-gdal-config=/opt/gdal.1.11.2/bin/gdal-config"
rgdal-0.9-2.tar.gz

However when R attempts to load rgdal at the end of the installation, it
fails with the error,

Error in dyn.load(file, DLLpath = DLLpath, ...) :
  unable to load shared object
'/usr/local/lib/R/site-library/rgdal/libs/rgdal.so':
  /usr/local/lib/R/site-library/rgdal/libs/rgdal.so: undefined symbol:
_ZN10OGRPolygon7addRingEP13OGRLinearRing

The addRing method on OGRPolygon seems to be a relic of GDAL 1.11.2 and no
longer exists in 2.0, so R is loading libgdal from /usr/local/lib, not
/opt/gdal-1.11.2/lib. I have confirmed this by temporarily moving the
1.11.2 libs into /usr/local, where it works fine.

So, the question is, how to I convince R to use the new library search
path? I'm on xubuntu, and R is installed using apt.

Thanks,
Rob

	[[alternative HTML version deleted]]



More information about the R-help mailing list