[R-sig-Geo] rgdal with R > 3.5.x and GDAL > 2.3.x on macOS

Roger Bivand Roger@Biv@nd @ending from nhh@no
Mon Aug 6 11:05:54 CEST 2018


See below inline:

On Mon, 6 Aug 2018, Patrick Schratz wrote:

> Hi,
>
> desperately trying to get rgdal installed on R > 3.5.x with GDAL 2.3.0 
> on macOS High Sierra. I am aware of the discussion that a suitable 
> compiler is needed since GDAL > 2.3.0.
>
> I've set
> CC=clang
> CXX=clang++
> PKG_CXXFLAGS= -stdlib=libc++ -std=c++11
>
> In ~/.R/Makevars as suggested here https://github.com/r-spatial/sf/issues/726

Does anyone actually know that this is a solution or rather the problem? 
Check:

$ R CMD config CXX
## clang++ -std=gnu++11
## for me with an R-devel clang build on Fedora 28

Run this and/or ./configure in the unpacked rgdal source tarball and 
report the CXX value. Is the issue advice wrong, and CXX should be 
'clang++ -std=gnu++11'?

I have no access to OSX (and no wish to have access) - the OSX users need 
to do a full bisection and not guess what is happening.

> The automated checking during the rgdal installation shows that C++11 
> support is available. But still it complains about a lacking C++11 
> support.

No, that is coming from code in GDAL itself, as you can see. You need to 
establish which --std= is actually needed.

> I've searched the web but could not find anything helpful. If I've 
> overlooked something, please just point me to the link.

Searching the web only confirms that there is very little signal there - 
search the source code instead, and bisection (which settings worked for 
which versions, and which changes provoke the issue)? Is for example the 
CRAN R binary reporting a different R CMD config CXX from your 
homebrew-built R?

>
> Everything installed via homebrew (bottles)
> R 3.5.1
> proj 5.1.0 (osgeo4mac)
> gdal 2.3.1 (homebrew core)
>
> macOS 10.13.1 (High Sierra)
>> install.packages("rgdal")
> Installing package into ‘/usr/local/lib/R/3.5/site-library’
> (as ‘lib’ is unspecified)
> trying URL 'https://cran.rstudio.com/src/contrib/rgdal_1.3-4.tar.gz'
> Content type 'application/x-gzip' length 1664774 bytes (1.6 MB)
> ==================================================
> downloaded 1.6 MB
>
> * installing *source* package ‘rgdal’ ...
> ** package ‘rgdal’ successfully unpacked and MD5 sums checked
> configure: R_HOME: /usr/local/Cellar/r/3.5.1/lib/R
> configure: CC: clang
> configure: CXX: clang++
> configure: C++11 support available
> configure: rgdal: 1.3-4
> checking for /usr/bin/svnversion... yes
> configure: svn revision: 766
> checking for gdal-config... /usr/local/bin/gdal-config
> checking gdal-config usability... yes
> configure: GDAL: 2.3.1
> checking C++11 support for GDAL >= 2.3.0... yes
> checking GDAL version >= 1.11.4... yes
> checking gdal: linking with --libs only... no
> checking gdal: linking with --libs and --dep-libs... no
> In file included from gdal_test.cc:1:
> In file included from /usr/local/Cellar/gdal2/2.3.1/include/gdal.h:45:
> /usr/local/Cellar/gdal2/2.3.1/include/cpl_port.h:187:6: error: Must have C++11 or newer.
> # error Must have C++11 or newer.
> ^


From the GDAL 2.3.1 source at the given line number - your __cplusplus 
from homebrew's value needs checking:

/* MSVC fails to define a decent value of __cplusplus. Try to target 
VS2015*/
/* as a minimum */

#if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)
#  if !(__cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1900))
#    error Must have C++11 or newer.
#  endif
#  if __cplusplus >= 201402L
#    define HAVE_CXX14 1
#  endif
/* TODO(schwehr): What is the correct test for C++ 17? */
#endif  /* __cplusplus */

Fallback is the CRAN OSX binary for rgdal 1.3-4 (with the addition of proj 
datum files as posted yesterday, or Kyngchaos (as on R-sig-mac).

Roger


> 1 error generated.
> In file included from gdal_test.cc:1:
> In file included from /usr/local/Cellar/gdal2/2.3.1/include/gdal.h:45:
> /usr/local/Cellar/gdal2/2.3.1/include/cpl_port.h:187:6: error: Must have C++11 or newer.
> # error Must have C++11 or newer.
> ^
> 1 error generated.
> configure: Install failure: compilation and/or linkage problems.
> configure: error: GDALAllRegister not found in libgdal.
> ERROR: configuration failed for package ‘rgdal’
> * removing ‘/usr/local/lib/R/3.5/site-library/rgdal’
> Warning in install.packages :
> installation of package ‘rgdal’ had non-zero exit status
>
> The downloaded source packages are in
> ‘/private/var/folders/nv/k87rzvfs55l6j6xt_0jwb4wm0000gn/T/Rtmp68hYW1/downloaded_packages’
>> install.packages("rgdal")
> Installing package into ‘/usr/local/lib/R/3.5/site-library’
> (as ‘lib’ is unspecified)
> trying URL 'https://cran.rstudio.com/src/contrib/rgdal_1.3-4.tar.gz'
> Content type 'application/x-gzip' length 1664774 bytes (1.6 MB)
> ==================================================
> downloaded 1.6 MB
>
> * installing *source* package ‘rgdal’ ...
> ** package ‘rgdal’ successfully unpacked and MD5 sums checked
> configure: R_HOME: /usr/local/Cellar/r/3.5.1/lib/R
> configure: CC: clang
> configure: CXX: clang++
> configure: C++11 support available
> configure: rgdal: 1.3-4
> checking for /usr/bin/svnversion... yes
> configure: svn revision: 766
> checking for gdal-config... /usr/local/bin/gdal-config
> checking gdal-config usability... yes
> configure: GDAL: 2.3.1
> checking C++11 support for GDAL >= 2.3.0... yes
> checking GDAL version >= 1.11.4... yes
> checking gdal: linking with --libs only... no
> checking gdal: linking with --libs and --dep-libs... no
> In file included from gdal_test.cc:1:
> In file included from /usr/local/Cellar/gdal/2.3.1_1/include/gdal.h:45:
> /usr/local/Cellar/gdal/2.3.1_1/include/cpl_port.h:187:6: error: Must have C++11 or newer.
> # error Must have C++11 or newer.
> ^
> 1 error generated.
> In file included from gdal_test.cc:1:
> In file included from /usr/local/Cellar/gdal/2.3.1_1/include/gdal.h:45:
> /usr/local/Cellar/gdal/2.3.1_1/include/cpl_port.h:187:6: error: Must have C++11 or newer.
> # error Must have C++11 or newer.
> ^
> 1 error generated.
> configure: Install failure: compilation and/or linkage problems.
> configure: error: GDALAllRegister not found in libgdal.
> ERROR: configuration failed for package ‘rgdal’
> * removing ‘/usr/local/lib/R/3.5/site-library/rgdal’
> Warning in install.packages :
> installation of package ‘rgdal’ had non-zero exit status
>
> The downloaded source packages are in
> ‘/private/var/folders/nv/k87rzvfs55l6j6xt_0jwb4wm0000gn/T/Rtmp68hYW1/downloaded_packages’
>
>
> 	[[alternative HTML version deleted]]

Do not post HTML, only plain text.

>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
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


More information about the R-sig-Geo mailing list