Message-ID: <alpine.LFD.2.21.1808061041170.12131@reclus.nhh.no>
Date: 2018-08-06T09:05:54Z
From: Roger Bivand
Subject: rgdal with R > 3.5.x and GDAL > 2.3.x on macOS
In-Reply-To: <1533543467.local-a91d34ea-ad39-v1.3.0-fd741eb7@getmailspring.com>
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.
> ^