When I am updating (or at least trying to) the rgdal package by compiling from source after updating R from 3.4.4 to 3.5.1, I run into the odd issue that all goes well, but the namespace load fails due to an "undefined symbol" error:
** installing vignettes
** testing if installed package can be loaded
Error: package or namespace load failed for ‘rgdal’ 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: _ZNK10OGRFeature16GetFieldAsDoubleEi
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/usr/local/lib/R/site-library/rgdal’
* restoring previous ‘/usr/local/lib/R/site-library/rgdal’
The downloaded source packages are in
‘/tmp/RtmpHu6D0N/downloaded_packages’
Warning message:
In install.packages("rgdal") :
installation of package ‘rgdal’ had non-zero exit status
When running echo _ZNK10OGRFeature16GetFieldAsDoubleEi | c++filt
I get as an output OGRFeature::GetFieldAsDouble(int) const
which doesn't learn me much. I have installed GDAL from https://trac.osgeo.org/gdal/wiki/DownloadSource , as suggested on the CRAN package site which shows that I have GDAL 2.3.1 installed.
It is odd that updates fail, as the package was already installed, so dependencies should have been met. Any pointers as to how to resolve this issue are warmly welcome.
As I got no suggestions in the past few weeks I decided to uninstall rgdal, and reinstall it. Interestingly, now I get a claim that my system (Ubuntu 16.04.5 LTS) does not support C++11, although the check says it is there (C++11 support available
):
* installing *source* package ‘rgdal’ ...
** package ‘rgdal’ successfully unpacked and MD5 sums checked
configure: R_HOME: /usr/lib/R
configure: CC: gcc -std=gnu99
configure: CXX: g++
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 /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.
^
In file included from /usr/local/include/gdal.h:49:0,
from gdal_test.cc:1:
/usr/local/include/cpl_minixml.h:202:47: error: expected template-name before '<' token
class CPLXMLTreeCloser: public std::unique_ptr<CPLXMLNode, CPLXMLTreeCloserDeleter>
^
/usr/local/include/cpl_minixml.h:202:47: error: expected '{' before '<' token
/usr/local/include/cpl_minixml.h:202:47: error: expected unqualified-id before '<' token
In file included from /usr/local/include/ogr_api.h:45:0,
from /usr/local/include/gdal.h:50,
from gdal_test.cc:1:
/usr/local/include/ogr_core.h:79:28: error: expected '}' before end of line
/usr/local/include/ogr_core.h:79:28: error: expected declaration before end of line
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.
^
In file included from /usr/local/include/gdal.h:49:0,
from gdal_test.cc:1:
/usr/local/include/cpl_minixml.h:202:47: error: expected template-name before '<' token
class CPLXMLTreeCloser: public std::unique_ptr<CPLXMLNode, CPLXMLTreeCloserDeleter>
^
/usr/local/include/cpl_minixml.h:202:47: error: expected '{' before '<' token
/usr/local/include/cpl_minixml.h:202:47: error: expected unqualified-id before '<' token
In file included from /usr/local/include/ogr_api.h:45:0,
from /usr/local/include/gdal.h:50,
from gdal_test.cc:1:
/usr/local/include/ogr_core.h:79:28: error: expected '}' before end of line
/usr/local/include/ogr_core.h:79:28: error: expected declaration before end of line
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/site-library/rgdal’
My devtools::session_info()
is the following:
Session info ------------------------------------------------------------------
setting value
version R version 3.5.1 (2018-07-02)
system x86_64, linux-gnu
ui X11
language en_US:en
collate en_US.UTF-8
tz Europe/Brussels
date 2018-07-28
Packages ----------------------------------------------------------------------
package * version date source
base * 3.5.1 2018-07-03 local
compiler 3.5.1 2018-07-03 local
datasets * 3.5.1 2018-07-03 local
devtools * 1.13.6 2018-06-27 CRAN (R 3.5.1)
digest 0.6.15 2018-01-28 CRAN (R 3.5.1)
graphics * 3.5.1 2018-07-03 local
grDevices * 3.5.1 2018-07-03 local
memoise 1.1.0 2017-04-21 CRAN (R 3.5.1)
methods * 3.5.1 2018-07-03 local
stats * 3.5.1 2018-07-03 local
tools 3.5.1 2018-07-03 local
utils * 3.5.1 2018-07-03 local
withr 2.1.2 2018-03-15 CRAN (R 3.5.1)