[R-sig-Geo] CRAN releases of sp, rgdal and rgeos

Tomislav Hengl tom@hengl @ending from gm@il@com
Mon Jun 25 10:04:24 CEST 2018


Few more notes on installation of GDAL 2.3.

I was installing GDAL and rgdal on another Ubuntu machine and I 
experiences multiple problems with more installations of GDAL and proj4 
probably ("unable to load shared object rgdal.so" error). This is what I 
realized needs to be done before installing GDAL from source:

1. Install libgdal-dev and libroj-dev (very important otherwise the 
installation of rgdal will fail)

|sudo apt-get install libgdal-dev libproj-dev|

2. Download GDAL source code 
(https://trac.osgeo.org/gdal/wiki/DownloadSource) and probably best 
install it using the checkinstall package:

sudo apt install checkinstall

wget http://download.osgeo.org/gdal/2.3.0/gdal-2.3.0.tar.gz

tar -xvzf gdal-2.3.0.tar.gz

cd gdal-2.3.0

./configure

sudo checkinstall

*checkinstall took 20 minutes on my system, so be ready to take coffee 
and relax.

3. This would build a debian package that can then be normally installed 
and removed using the gdebi.

4. Install rgdal using install.packages("rgdal")

Thanks Roger for keeping everything up-to-date and stable! GDAL is the 
backbone of almost any GIS project I run.

Tom


On 19.06.2018 16:57, Tomislav Hengl wrote:
>
> Hi Roger,
>
> I have now managed to reinstall GDAL 2.3 and the latest versions of 
> rgdal and sf. These are the steps I have followed:
>
> 1. First remove existing installation of GDAL using:
>
> sudo apt-get purge --auto-remove gdal-bin
>
> *this also removes QGIS / anything linked with GDAL.
>
> 2. Download GDAL source code 
> (https://trac.osgeo.org/gdal/wiki/DownloadSource) and follow the 
> instructions to install from source 
> (https://trac.osgeo.org/gdal/wiki/BuildingOnUnix)
>
> 3. Installation from source code takes quite some time (10-15 
> minutes). After that I get:
>
> gdalinfo --version
> GDAL 2.3.0, released 2018/05/04
>
> 4. Install rgdal from R-forge using e.g.:
>
> R CMD INSTALL rgdal_1.3-3.tar.gz
> * installing to library ‘/opt/microsoft/ropen/3.4.3/lib64/R/library’
> * installing *source* package ‘rgdal’ ...
> checking for g++... g++
> 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 g++ accepts -g... yes
> configure: CC: gcc -std=gnu99
> configure: CXX: g++
> configure: rgdal: 1.3-3
> checking for /usr/bin/svnversion... yes
> cat: inst/SVN_VERSION: No such file or directory
> configure: svn revision:
> checking whether g++ supports C++11 features by default... no
> checking whether g++ supports C++11 features with -std=gnu++11... yes
> configure: C++11 support available
> checking for gdal-config... /usr/local/bin/gdal-config
> checking gdal-config usability... yes
> configure: GDAL: 2.3.0
> checking C++11 support for GDAL >= 2.3.0... yes
> checking GDAL version >= 1.11.4... yes
> checking gdal: linking with --libs only... yes
> checking GDAL: /usr/local/share/gdal/pcs.csv readable... yes
> configure: pkg-config proj exists, will use it
> configure: PROJ version: 4.9.2
> checking proj_api.h presence and usability... yes
> checking PROJ version >= 4.8.0... yes
> checking projects.h presence and usability... yes
> checking PROJ.4: epsg found and readable... yes
> checking PROJ.4: conus found and readable... yes
> configure: Package CPP flags:  -I/usr/local/include
> configure: Package LIBS:  -L/usr/local/lib -lgdal -lproj
> configure: creating ./config.status
>
> For sf I had to manually update DBI and units packages as it requires 
> newest versions.
>
> So now everything works fine. Thank you!
>
> Tom
>
> On 06/19/2018 10:41 AM, Roger Bivand wrote:
>> On Tue, 19 Jun 2018, Tomislav Hengl wrote:
>>
>>> Two weeks ago I installed new GDAL 2.3.* from source, then tried
>>> installing rgdal and got the error about GDAL requires C++11. Then I 
>>> had
>>> to remove everything and reinstall GDAL 2.2. Would love to be able to
>>> start using the newest GDAL inside R as it seems that many things have
>>> been improved
>>> (https://trac.osgeo.org/gdal/query?group=status&milestone=2.3.0).
>>> Installing GDAL from source takes >20mins so next time I would like to
>>> be sure that I will not have to remove GDAL.
>>>
>>> Can somebody point to a step-by-step guide to install GDAL 2.3.* and
>>> rgdal on ubuntu (now that all packages have been updated)?
>>
>> Tom:
>>
>> There is too little information here: which g++ compiler version, was 
>> R installed from source or not, GDAL was installed from source, but 
>> was PROJ installed from source (and/or GEOS), ... and no verbatim 
>> error message.
>>
>> Please try development rgdal_1.3-3 from R-forge, which has some logic 
>> fixes in configure:
>>
>> install.packages("rgdal", repos="http://R-Forge.R-project.org")
>>
>> Did you check whether sf installed with GDAL 2.3.0 and PROJ 5.1.0?
>>
>> It looks as though CRAN devel debian is using GDAL 2.3.0 (the test 
>> saved output is 2.2.4):
>>
>> https://www.r-project.org/nosvn/R.check/r-devel-linux-x86_64-debian-gcc/rgdal-00check.html 
>>
>>
>> Hope this helps,
>>
>> Roger
>>
>>>
>>> Much appreciated!
>>>
>>> My session info:
>>>
>>> > library(rgdal)
>>> Loading required package: sp
>>> rgdal: version: 1.2-20, (SVN revision 725)
>>>  Geospatial Data Abstraction Library extensions to R successfully 
>>> loaded
>>>  Loaded GDAL runtime: GDAL 2.2.2, released 2017/09/15
>>>  Path to GDAL shared files: /usr/share/gdal/2.2
>>>  GDAL binary built with GEOS: TRUE
>>>  Loaded PROJ.4 runtime: Rel. 4.9.2, 08 September 2015, [PJ_VERSION: 
>>> 492]
>>>  Path to PROJ.4 shared files: (autodetected)
>>>  Linking to sp version: 1.2-7
>>> > sessionInfo()
>>> R version 3.5.0 (2018-04-23)
>>> Platform: x86_64-pc-linux-gnu (64-bit)
>>> Running under: Ubuntu 16.04.4 LTS
>>>
>>> Matrix products: default
>>> BLAS: /opt/microsoft/ropen/3.5.0/lib64/R/lib/libRblas.so
>>> LAPACK: /opt/microsoft/ropen/3.5.0/lib64/R/lib/libRlapack.so
>>>
>>>
>>>
>>> On 19.06.2018 08:47, Roger Bivand wrote:
>>>> On Mon, 18 Jun 2018, MacQueen, Don wrote:
>>>>
>>>>> Success!
>>>>>
>>>>> This morning I upgraded a Mac to OS 10.13.5 (the so-called High
>>>>> Sierra version), then
>>>>>
>>>>> - Installed R 3.5.0 from CRAN (installed ever 3.3.x)
>>>>> - Installed sp 1.3-1, rgdal 1.3-2, rgeos 0.3-28, also sf 0.6-3, 
>>>>> from the
>>>>>   CRAN binaries that are now available
>>>>> - Ran my personal test suite, which exercises the kinds of tasks I
>>>>>   perform with those packages
>>>>>
>>>>> All tests succeeded.
>>>>
>>>> Thanks for reporting - especially on your own test suite. We do what
>>>> we can to cover typical use cases, but independent testing in
>>>> production settings is reassuring for everybody. We're expecting more
>>>> PROJ-based changes later this year and next year, so it is great to
>>>> have external test sets to be able to check where any changes in
>>>> output are coming from.
>>>>
>>>> This is an encouragement to other users whose production depends on R
>>>> packages using GDAL, PROJ and/or GEOS to follow this example and keep
>>>> a script handy to test your use cases, and a history of output files
>>>> with which to compare (diff). We don't worry about changes in the EPSG
>>>> versions, but by next year they may be properly anchored too (changes
>>>> in PROJ may include reference system definitions with timestamps).
>>>>
>>>>>
>>>>> I forgot to control the order of installation, so I don't know if I
>>>>> installed sp first, as advised. But I expect that with the binary
>>>>> versions it doesn't matter.
>>>>
>>>> Right, the binary builds use the sp version on the build platform.
>>>>
>>>> Best wishes,
>>>>
>>>> Roger
>>>>
>>>>>
>>>>> (I don't think it matters for the above, but I also installed the
>>>>> clang and gfortran version provided on CRAN's Mac "tools" page, and
>>>>> successfully compiled some source packages that require fortran, and
>>>>> others that require C).
>>>>>
>>>>> Thank again for all your work
>>>>> -Don
>>>>>
>>>>> -- 
>>>>> Don MacQueen
>>>>> Lawrence Livermore National Laboratory
>>>>> 7000 East Ave., L-627
>>>>> Livermore, CA 94550
>>>>> 925-423-1062
>>>>> Lab cell 925-724-7509
>>>>>
>>>>>
>>>>>
>>>>> On 6/8/18, 11:15 AM, "R-sig-Geo on behalf of Roger Bivand"
>>>>> <r-sig-geo-bounces using r-project.org on behalf of Roger.Bivand using nhh.no>
>>>>> wrote:
>>>>>
>>>>>    There are new releases of sp, rgdal and rgeos on CRAN. Please
>>>>> install sp
>>>>>    first, then the other two, which link to the installed sp. They 
>>>>> all
>>>>>    address so-called rchk issues, which have not so far been a
>>>>> problem, but
>>>>>    might have become more fragile as R's internal memory management
>>>>> is made
>>>>>    even more efficient. This involves compiled code using memory
>>>>> allocated by
>>>>>    R to be freed by R's garbage collector, which has to know if an
>>>>> object is
>>>>>    still being used. Tomas Kalibera, the author of rchk, helped
>>>>> resolve and
>>>>>    explain the issues encountered - what was good coding practice
>>>>> fifteen
>>>>>    years ago isn't always still good practice.
>>>>>
>>>>>    In addition, the earliest versions of GDAL and PROJ with which
>>>>> rgdal will
>>>>>    work have been updated, and set to PROJ 4.8.0 and GDAL 1.11.4. The
>>>>> current
>>>>>    released versions of PROJ and GDAL are to be prefered, as bugs
>>>>> have been
>>>>>    fixed and new features and drivers introduced. A check has been 
>>>>> put
>>>>>    in place to trap attempts to install rgdal without a C++11-capable
>>>>>    compiler when the GDAL version is >=2.3.0 - which requires C++11.
>>>>> rgeos is
>>>>>    ready for the forthcoming version of GEOS.
>>>>>
>>>>>    The CRAN team has also been very supportive of our efforts to 
>>>>> bring
>>>>>    compiled code in these packages into rchk compliance.
>>>>>
>>>>>    Please get in touch if you see any loose ends in these releases.
>>>>>
>>>>>    Roger
>>>>>
>>>>>    --
>>>>>    Roger Bivand
>>>>>    Department of Economics, Norwegian School of Economics,
>>>>>    Helleveien 30, N-5045 Bergen, Norway.
>>>>>    voice: +47 55 95 93 55; e-mail: Roger.Bivand using nhh.no
>>>>>    http://orcid.org/0000-0003-2392-6140
>>>>> https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
>>>>>
>>>>>    _______________________________________________
>>>>>    R-sig-Geo mailing list
>>>>>    R-sig-Geo using r-project.org
>>>>>    https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> R-sig-Geo mailing list
>>>> R-sig-Geo using r-project.org
>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>
>>>
>>>     [[alternative HTML version deleted]]
>>>
>>> _______________________________________________
>>> R-sig-Geo mailing list
>>> R-sig-Geo using r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>
>>



More information about the R-sig-Geo mailing list