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]]
Rob Skelly <rob <at> dijital.ca> writes:> > 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 >There are several questions here. Firstly, R-sig-geo is the appropriate list for questions of this kind, if we ignore the need to understand library search path management under a particular linux distribution. GDAL 2.0 has not been released yet, and is not backward compatible with GDAL 1 (they use different object models). It is true that a release date at the end of this month was proposed, but has not yet been confirmed. Given the uncertain status of GDAL 2, there is no pressing reason to divert maintainer assets to implementing changes in rgdal that may need frequent revision tracking changes in GDAL 2, and keeping a parallel object structure for released GDAL 1.*. You do not say why GDAL 2 is essential for your work - maybe you could simply use GDAL 1* until GDAL 2 stabilises? Neither your motivation nor your affiliation are very convincing. Please never post HTML-formatted mail. Roger> > 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]] > >
On 22/04/2015 05:43, Rob Skelly wrote:> 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.You can *really* confirm where things are found via R CMD ldd ... see the manual.> 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.You either use the ld options when building rgdal.so (e.g. for your OS -Wl,-rpath=/opt/gdal-1.11.2/lib) or you link statically. The latter is easier and safer ... just build a static GDAL. Many projects set -R/-rpath flags in their config scripts: it is something you could suggest to the GDAL maintainers (and finding them is part of libtool which GDAL uses). But (see the posting guide) the generic question belonged on R-devel and questions about rgdal on R-sig-geo.> Thanks, > Rob> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html-- Brian D. Ripley, ripley at stats.ox.ac.uk Emeritus Professor of Applied Statistics, University of Oxford 1 South Parks Road, Oxford OX1 3TG, UK
> > You can *really* confirm where things are found via R CMD ldd ... see > the manual. > > Yes of course. I had done that, and received the hoped-for response:libgdal.so.1 => /opt/gdal-1.11.2/lib/libgdal.so.1 (0x00007fd9e0175000) But I realize now that this was with LD_LIBRARY_PATH set. Of course R modifies LD_LIBRARY_PATH, erasing any paths set by the user, so that while the installation succeeds, the load doesn't. I've temporarily modified ldpaths and it works. So there's the answer for now. But (see the posting guide) the generic question belonged on R-devel and> questions about rgdal on R-sig-geo. >Apologies. I'll ask there next time. Rob [[alternative HTML version deleted]]