Skip to content

error installing rgdal with gdal 2.3.0 on centos7

3 messages · Roger Bivand, Laura Poggio

#
Dear all,
I am trying to install rgdal on a centos 7 machine.
First I installed from source gdal 2.3.0. No errors and it is working as
expected.

I then tried to install rgdal using R 3.4.4

I get the error:

In file included from /usr/local/include/gdal.h:45:0,
                 from gdal_test.cc:1:
/usr/local/include/cpl_port.h:187:6: error: #error Must have C++11 or newer.
 #    error Must have C++11 or newer.

I can use a previous version of gdal (2.2.1) without problems, but I was
wondering if other people found a more robust solution that could work with
future versions.

Thanks a lot

Laura
#
On Tue, 29 May 2018, Laura Poggio wrote:

            
Which version of rgdal - the current CRAN source?
Is this during configure? Could you try by downloading the tarball and 
running

R CMD INSTALL rgdal_1-2.20.tar.gz

In configure, the value of CXX is taken from "${RBIN}" CMD config CXX 
where "${RBIN}" is RBIN="${R_HOME}/bin/R" and R_HOME=`R RHOME`, so

R CMD config CXX

which in your case may need -std=g++11 or some such added - please inform.

Roger

  
    
#
Dear Roger,
I was trying to install the version from CRAN, sorry I should have
mentioned it.

The C++ compiler on centos7 seemed to be too old. The solution that worked
was:
installing the devtoolset environment
activate the environment
run R  CMD INSTALL rgdal_1-2.20.tar.gz from the activated environment
(normal install.packages("rgdal") worked as well)
exit the environment

The package is now working without problems (hopefully ... initial tests
fine).

Thanks a lot for the help that set us on the right path.

Laura
On 29 May 2018 at 17:18, Roger Bivand <Roger.Bivand at nhh.no> wrote: