sf install on Ubuntu fails - no member named SetAxisMappingStrategy - r

sf install on Ubuntu 18.04 fails with:
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal -I/usr/include -I'/usr/local/lib/R/site-library/Rcpp/include' -fpic -g -O2 -fdebug-prefix-map=/build/r-base-J7pprH/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c signed_area.cpp -o signed_area.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal -I/usr/include -I'/usr/local/lib/R/site-library/Rcpp/include' -fpic -g -O2 -fdebug-prefix-map=/build/r-base-J7pprH/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c stars.cpp -o stars.o
stars.cpp: In function ‘void CPL_create(Rcpp::CharacterVector, Rcpp::IntegerVector, Rcpp::NumericVector, Rcpp::CharacterVector, Rcpp::NumericVector, Rcpp::NumericVector)’:
stars.cpp:771:7: error: ‘class OGRSpatialReference’ has no member named ‘SetAxisMappingStrategy’
oSRS.SetAxisMappingStrategy(OAMS_TRADITIONAL_GIS_ORDER);
^~~~~~~~~~~~~~~~~~~~~~
stars.cpp:771:30: error: ‘OAMS_TRADITIONAL_GIS_ORDER’ was not declared in this scope
oSRS.SetAxisMappingStrategy(OAMS_TRADITIONAL_GIS_ORDER);
^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/R/etc/Makeconf:177: recipe for target 'stars.o' failed
make: *** [stars.o] Error 1
ERROR: compilation failed for package ‘sf’
* removing ‘/usr/local/lib/R/site-library/sf’
The downloaded source packages are in
‘/tmp/RtmpDZ9Qvj/downloaded_packages’
Warning message:
In install.packages("sf") :
installation of package ‘sf’ had non-zero exit status
Any suggestions appreciated.

Solved by installing the development versions (sf_1.0-7) from GitHub with:
library(devtools)
install_github("r-spatial/sf")

Related

ERROR: compilation failed for package 'kernlab'; appears to fail when running some function 'dcauchy'

I'm getting an error while trying to install kernlab for R. My R version is 3.5.2. My OS is ChromeOS 108.0.5359.58 beta (64-bit), with Debian 10 (buster). Processor is an intel m3-8100Y (64-bit).
The error I'm getting doesn't seem to have been reported when trying to search for either problems with kernlab or dcauchy.c, though if there has been a previous question identical to mine, apologies!
> install.packages("kernlab", type="source")
Installing package into ‘/home/user/R/x86_64-pc-linux-gnu-library/3.5’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/kernlab_0.9-31.tar.gz'
Content type 'application/x-gzip' length 1215549 bytes (1.2 MB)
==================================================
downloaded 1.2 MB
* installing *source* package ‘kernlab’ ...
** package ‘kernlab’ successfully unpacked and MD5 sums checked
** libs
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c brweight.cpp -o brweight.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c ctable.cpp -o ctable.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c cweight.cpp -o cweight.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c dbreakpt.c -o dbreakpt.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c dcauchy.c -o dcauchy.o
dcauchy.c: In function ‘dcauchy’:
dcauchy.c:110:13: error: expected ‘)’ before ‘FCONE’
wa, &inc FCONE);
^~~~~~
)
dcauchy.c:132:67: error: expected ‘)’ before ‘FCONE’
F77_CALL(dsymv)("U", &n, &one, A, &n, s, &inc, &zero, wa, &inc FCONE);
^~~~~~
)
dcauchy.c:156:67: error: expected ‘)’ before ‘FCONE’
F77_CALL(dsymv)("U", &n, &one, A, &n, s, &inc, &zero, wa, &inc FCONE);
^~~~~~
)
make: *** [/usr/lib/R/etc/Makeconf:162: dcauchy.o] Error 1
ERROR: compilation failed for package ‘kernlab’
* removing ‘/home/user/R/x86_64-pc-linux-gnu-library/3.5/kernlab’
The downloaded source packages are in
‘/tmp/RtmpUQr5y3/downloaded_packages’
Warning message:
In install.packages("kernlab", type = "source") :
installation of package ‘kernlab’ had non-zero exit status
I tried searching around for solutions, but nothing seems to have been posted. I would expect kernlab to install properly as it is required for certain parts of the caret package to also work properly, which I am using. Unfortunately, when I run install.packages("kernlab"), I instead get the above error. This includes trying to run R with sudo.
Just in case anyone has this issue in the future, I did manage to get it working. I noticed that I couldn't install kernlab on my Debian WSL on Windows either but it would work in windows Rterm. So one solution is to apparently not use linux.
Once I identified that it seemed to be specifically linux where install.packages("kernlab") failed, I did some googling and saw that kernlab was available on the debian repos.
sudo apt-get install r-cran-kernlab thus did the charm.

failure to install packages in RStudio

I am a bit new to RStudio, I had the previous version but I uninstalled it to install the latest version but when I try to install any package (I try to install tidyverse as an example) it does not install and what appears is the following:
Installing package into ‘/home/edgardo/R/x86_64-pc-linux-gnu-library/4.1’
(as ‘lib’ is unspecified)
also installing the dependencies ‘broom’, ‘haven’, ‘modelr’, ‘readr’, ‘feather’, ‘testthat’
trying URL 'https://cloud.r-project.org/src/contrib/broom_0.7.9.tar.gz'
Content type 'application/x-gzip' length 631606 bytes (616 KB)
==================================================
downloaded 616 KB
trying URL 'https://cloud.r-project.org/src/contrib/haven_2.4.3.tar.gz'
Content type 'application/x-gzip' length 296805 bytes (289 KB)
==================================================
downloaded 289 KB
trying URL 'https://cloud.r-project.org/src/contrib/modelr_0.1.8.tar.gz'
Content type 'application/x-gzip' length 121333 bytes (118 KB)
==================================================
downloaded 118 KB
trying URL 'https://cloud.r-project.org/src/contrib/readr_2.0.1.tar.gz'
Content type 'application/x-gzip' length 517944 bytes (505 KB)
==================================================
downloaded 505 KB
trying URL 'https://cloud.r-project.org/src/contrib/feather_0.3.5.tar.gz'
Content type 'application/x-gzip' length 73812 bytes (72 KB)
==================================================
downloaded 72 KB
trying URL 'https://cloud.r-project.org/src/contrib/testthat_3.0.4.tar.gz'
Content type 'application/x-gzip' length 688142 bytes (672 KB)
==================================================
downloaded 672 KB
trying URL 'https://cloud.r-project.org/src/contrib/tidyverse_1.3.1.tar.gz'
Content type 'application/x-gzip' length 702779 bytes (686 KB)
==================================================
downloaded 686 KB
* installing *source* package ‘broom’ ...
** package ‘broom’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (broom)
ERROR: failed to lock directory ‘/home/edgardo/R/x86_64-pc-linux-gnu-library/4.1’ for modifying
Try removing ‘/home/edgardo/R/x86_64-pc-linux-gnu-library/4.1/00LOCK-readr’
Warning in install.packages :
installation of package ‘readr’ had non-zero exit status
* installing *source* package ‘feather’ ...
** package ‘feather’ successfully unpacked and MD5 sums checked
** using staged installation
Platform is little endian. Good.
** libs
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I. -I'/home/edgardo/R/x86_64-pc-linux-gnu-library/4.1/Rcpp/include' -fpic -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c RcppExports.cpp -o RcppExports.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I. -I'/home/edgardo/R/x86_64-pc-linux-gnu-library/4.1/Rcpp/include' -fpic -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c feather-read.cpp -o feather-read.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I. -I'/home/edgardo/R/x86_64-pc-linux-gnu-library/4.1/Rcpp/include' -fpic -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c feather-types.cpp -o feather-types.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I. -I'/home/edgardo/R/x86_64-pc-linux-gnu-library/4.1/Rcpp/include' -fpic -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c feather-write.cpp -o feather-write.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I. -I'/home/edgardo/R/x86_64-pc-linux-gnu-library/4.1/Rcpp/include' -fpic -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c feather/buffer.cc -o feather/buffer.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I. -I'/home/edgardo/R/x86_64-pc-linux-gnu-library/4.1/Rcpp/include' -fpic -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c feather/feather-c.cc -o feather/feather-c.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I. -I'/home/edgardo/R/x86_64-pc-linux-gnu-library/4.1/Rcpp/include' -fpic -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c feather/io.cc -o feather/io.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I. -I'/home/edgardo/R/x86_64-pc-linux-gnu-library/4.1/Rcpp/include' -fpic -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c feather/metadata.cc -o feather/metadata.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I. -I'/home/edgardo/R/x86_64-pc-linux-gnu-library/4.1/Rcpp/include' -fpic -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c feather/reader.cc -o feather/reader.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I. -I'/home/edgardo/R/x86_64-pc-linux-gnu-library/4.1/Rcpp/include' -fpic -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c feather/status.cc -o feather/status.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I. -I'/home/edgardo/R/x86_64-pc-linux-gnu-library/4.1/Rcpp/include' -fpic -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c feather/types.cc -o feather/types.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I. -I'/home/edgardo/R/x86_64-pc-linux-gnu-library/4.1/Rcpp/include' -fpic -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c feather/writer.cc -o feather/writer.o
ar rcs libfeather.a feather/buffer.o feather/feather-c.o feather/io.o feather/metadata.o feather/reader.o feather/status.o feather/types.o feather/writer.o
g++ -std=gnu++11 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o feather.so RcppExports.o feather-read.o feather-types.o feather-write.o -L. -lfeather -L/usr/lib/R/lib -lR
installing to /home/edgardo/R/x86_64-pc-linux-gnu-library/4.1/00LOCK-feather/00new/feather/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (feather)
* installing *source* package ‘testthat’ ...
** package ‘testthat’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I../inst/include -DCOMPILING_TESTTHAT -fpic -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c init.c -o init.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I../inst/include -DCOMPILING_TESTTHAT -fpic -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c reassign.c -o reassign.o
g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I../inst/include -DCOMPILING_TESTTHAT -fpic -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c test-catch.cpp -o test-catch.o
g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I../inst/include -DCOMPILING_TESTTHAT -fpic -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c test-example.cpp -o test-example.o
g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I../inst/include -DCOMPILING_TESTTHAT -fpic -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c test-runner.cpp -o test-runner.o
g++ -std=gnu++14 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o testthat.so init.o reassign.o test-catch.o test-example.o test-runner.o -L/usr/lib/R/lib -lR
installing to /home/edgardo/R/x86_64-pc-linux-gnu-library/4.1/00LOCK-testthat/00new/testthat/libs
** R
** inst
** byte-compile and prepare package for lazy loading
This repeats for an indefinite period of time which I have to stop it but it never installs the package, I am on Ubuntu 20.04 operating system.

"pcadapt", "installation of package ‘bigutilsr’ had non-zero exit status"

I'm trying to install the pcadapt in RStudio using
> remotes::install_github("bcm-uga/pcadapt")
But it gives me the error installation of package ‘bigutilsr’ had non-zero exit status
Downloading GitHub repo bcm-uga/pcadapt#master
Installing 1 packages: bigutilsr
Installing package into ‘/home/jenifer/R/x86_64-pc-linux-gnu-library/3.5’
(as ‘lib’ is unspecified)
probando la URL 'https://cloud.r-project.org/src/contrib/bigutilsr_0.3.2.tar.gz'
Content type 'application/x-gzip' length 915116 bytes (893 KB)
==================================================
downloaded 893 KB
* installing *source* package ‘bigutilsr’ ...
** package ‘bigutilsr’ successfully unpacked and MD5 sums checked
** libs
g++ -I"/usr/share/R/include" -DNDEBUG -I"/home/jenifer/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c RcppExports.cpp -o RcppExports.o
g++ -I"/usr/share/R/include" -DNDEBUG -I"/home/jenifer/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c ogk.cpp -o ogk.o
g++ -I"/usr/share/R/include" -DNDEBUG -I"/home/jenifer/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c rollmean.cpp -o rollmean.o
g++ -I"/usr/share/R/include" -DNDEBUG -I"/home/jenifer/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c rowSumsSq.cpp -o rowSumsSq.o
g++ -shared -L/usr/lib/R/lib -Wl,-z,relro -o bigutilsr.so RcppExports.o ogk.o rollmean.o rowSumsSq.o -L/usr/lib/R/lib -lR
installing to /home/jenifer/R/x86_64-pc-linux-gnu-library/3.5/bigutilsr/libs
** R
** inst
** byte-compile and prepare package for lazy loading
Warning: S3 methods ‘eigs.matrix’, ‘eigs.dgeMatrix’, ‘eigs.dgCMatrix’, ‘eigs.dgRMatrix’, ‘eigs.dsyMatrix’, ‘eigs.dsCMatrix’, ‘eigs.dsRMatrix’, ‘eigs.function’, ‘eigs_sym.matrix’, ‘eigs_sym.dgeMatrix’, ‘eigs_sym.dgCMatrix’, ‘eigs_sym.dgRMatrix’, ‘eigs_sym.function’, ‘svds.matrix’, ‘svds.dgeMatrix’, ‘svds.dgCMatrix’, ‘svds.dgRMatrix’, ‘svds.dsyMatrix’, ‘svds.dsCMatrix’, ‘svds.dsRMatrix’, ‘svds.function’ were declared in NAMESPACE but not found
Error in library.dynam(lib, package, package.lib) :
shared object ‘RSpectra.so’ not found
ERROR: lazy loading failed for package ‘bigutilsr’
* removing ‘/home/jenifer/R/x86_64-pc-linux-gnu-library/3.5/bigutilsr’
Error: Failed to install 'pcadapt' from GitHub:
(convertido del aviso) installation of package ‘bigutilsr’ had non-zero exit status
>
I've been searching on google and it seems that if gcc isn't set up correctly, then R tries to compile the packages and it fails (https://community.rstudio.com/t/cannot-install-any-packages-non-zero-exit-status/53310), but I don't know if this is the case, and if it is, I don't know how to solve it.
gcc --version
gcc (Debian 8.3.0-6) 8.3.0
I'm also having similar issues while trying to install adegenet, hierfstat, pegas, poppr and other packages but I will put a post about this with moor details somewhere else ins stackoverflow just to keep it simple and to not give place to confussion with the code.
If somebody can help me, I will appreciate it very much
Cheers

More problems installing rgdal on Ubuntu 16.04 - undefined symbol

I've been trying various suggestions on the many threads discussing how to install rgdal onto Ubuntu 16.04, and am still having trouble.
Here's where I've gotten to, after many false attempts. I tried the answer here (trouble in installing rgdal on ubuntu 16.04):
sudo add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable
sudo apt update
sudo apt install gdal-bin python-gdal python3-gdal libgdal1-dev
This mostly worked, except that for libgdal1-dev, my package manager says the available version is 1.11.3, and that seemed to be giving me difficulties (not sure I can replicate at this stage), so I used Synaptic to uninstall that package and to install libgdal-dev instead, which had been flagged by Synaptic.
So at this point, according to Synaptic, when I do a search for "gdal", the installed files that show up are gdal-bin, gdal-data, libgdal-dev, libgdal20, python-gdal, and python3-gdal.
At this point, when I open R and run install.packages("rgdal"), this is what I get back:
Installing package into ‘/home/[username]/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/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/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... no
configure: svn revision: 766
checking for gdal-config... /usr/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 2.2.2
checking GDAL version >= 1.11.4... yes
checking gdal: linking with --libs only... yes
checking GDAL: /usr/share/gdal/2.2/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/include/gdal
configure: Package LIBS: -L/usr/lib -lgdal -lproj
configure: creating ./config.status
config.status: creating src/Makevars
** libs
g++ -std=gnu++11 -I/usr/share/R/include -DNDEBUG -I/usr/include/gdal -I"/home/[username]/R/x86_64-pc-linux-gnu-library/3.4/sp/include" -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c OGR_write.cpp -o OGR_write.o
g++ -std=gnu++11 -I/usr/share/R/include -DNDEBUG -I/usr/include/gdal -I"/home/[username]/R/x86_64-pc-linux-gnu-library/3.4/sp/include" -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c gdal-bindings.cpp -o gdal-bindings.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/gdal -I"/home/[username]/R/x86_64-pc-linux-gnu-library/3.4/sp/include" -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c init.c -o init.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/gdal -I"/home/[username]/R/x86_64-pc-linux-gnu-library/3.4/sp/include" -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c inverser.c -o inverser.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/gdal -I"/home/[username]/R/x86_64-pc-linux-gnu-library/3.4/sp/include" -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c local_stubs.c -o local_stubs.o
g++ -std=gnu++11 -I/usr/share/R/include -DNDEBUG -I/usr/include/gdal -I"/home/[username]/R/x86_64-pc-linux-gnu-library/3.4/sp/include" -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c ogr_geom.cpp -o ogr_geom.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/gdal -I"/home/[username]/R/x86_64-pc-linux-gnu-library/3.4/sp/include" -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c ogr_polygons.c -o ogr_polygons.o
g++ -std=gnu++11 -I/usr/share/R/include -DNDEBUG -I/usr/include/gdal -I"/home/[username]/R/x86_64-pc-linux-gnu-library/3.4/sp/include" -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c ogr_proj.cpp -o ogr_proj.o
g++ -std=gnu++11 -I/usr/share/R/include -DNDEBUG -I/usr/include/gdal -I"/home/[username]/R/x86_64-pc-linux-gnu-library/3.4/sp/include" -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c ogrdrivers.cpp -o ogrdrivers.o
g++ -std=gnu++11 -I/usr/share/R/include -DNDEBUG -I/usr/include/gdal -I"/home/[username]/R/x86_64-pc-linux-gnu-library/3.4/sp/include" -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c ogrsource.cpp -o ogrsource.o
g++ -std=gnu++11 -I/usr/share/R/include -DNDEBUG -I/usr/include/gdal -I"/home/[username]/R/x86_64-pc-linux-gnu-library/3.4/sp/include" -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c projectit.cpp -o projectit.o
g++ -std=gnu++11 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o rgdal.so OGR_write.o gdal-bindings.o init.o inverser.o local_stubs.o ogr_geom.o ogr_polygons.o ogr_proj.o ogrdrivers.o ogrsource.o projectit.o -L/usr/lib -lgdal -lproj -L/usr/lib/R/lib -lR
installing to /home/[username]/R/x86_64-pc-linux-gnu-library/3.4/rgdal/libs
** R
** data
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** 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 '/home/[username]/R/x86_64-pc-linux-gnu-library/3.4/rgdal/libs/rgdal.so':
/home/[username]/R/x86_64-pc-linux-gnu-library/3.4/rgdal/libs/rgdal.so: undefined symbol: _ZN10OGRFeature17GetFieldAsIntegerEi
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/[username]/R/x86_64-pc-linux-gnu-library/3.4/rgdal’
The downloaded source packages are in
‘/tmp/Rtmpuc6qcT/downloaded_packages’
Warning message:
In install.packages("rgdal") :
installation of package ‘rgdal’ had non-zero exit status
I did a search for the error message, and found this question (Cannot install rgdal package in R on RHEL6, unable to load shared object rgdal.so), so tried running
ldconfig -c "echo '/usr/local/lib' >> /etc/ld.so.conf.d/R-dependencies-x86_64.conf"
but it doesn't seem to do anything and I'm still getting the same error message when I try to install rgdal.
Where do I go from here?
I'm on Ubuntu 18.04 but I just got the same problem (exact same error log) the solution for me was to link rgdal to a custom built of gdal. I was lucky enough that for other reason I already had a copy of GDAL (git master) built from source in /usr/local/gdal. So to install rgdal from source all i needed was to:
wget https://cran.r-project.org/src/contrib/rgdal_1.3-4.tar.gz
sudo R CMD INSTALL --configure-args=--with-gdal-config=/usr/local/gdal/bin/gdal-config rgdal_1.3-4.tar.gz
If you go this path, make sure your gdal installation has all the projection data installed in the expected location, mine wasn't so I had to add an extra step:
sudo cp -r /path/to/gdal-src-code/gdal/data/* /usr/local/gdal/share/gdal/

Cannot install roxygen2 on Debian Jessie

When I try to install roxygen2 I get:
> sudo Rscript -e 'install.packages("roxygen2", repos="http://mirrors.dotsrc.org/cran/")'
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
trying URL 'http://mirrors.dotsrc.org/cran/src/contrib/roxygen2_5.0.1.tar.gz'
Content type 'text/plain' length 106197 bytes (103 Kb)
opened URL
==================================================
downloaded 103 Kb
* installing *source* package ‘roxygen2’ ...
** package ‘roxygen2’ successfully unpacked and MD5 sums checked
** libs
g++ -I/usr/share/R/include -DNDEBUG -I"/usr/lib/R/site-library/Rcpp/include" -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c RcppExports.cpp -o RcppExports.o
g++ -I/usr/share/R/include -DNDEBUG -I"/usr/lib/R/site-library/Rcpp/include" -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c isComplete.cpp -o isComplete.o
g++ -I/usr/share/R/include -DNDEBUG -I"/usr/lib/R/site-library/Rcpp/include" -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c leadingSpaces.cpp -o leadingSpaces.o
g++ -I/usr/share/R/include -DNDEBUG -I"/usr/lib/R/site-library/Rcpp/include" -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c parser2.cpp -o parser2.o
parser2.cpp: In function ‘Rcpp::CharacterVector find_includes(std::string)’:
parser2.cpp:165:35: error: too many arguments to function ‘void Rcpp::stop(const string&)’
stop("Failed to open %s", path);
^
In file included from /usr/lib/R/site-library/Rcpp/include/RcppCommon.h:131:0,
from /usr/lib/R/site-library/Rcpp/include/Rcpp.h:27,
from parser2.cpp:1:
/usr/lib/R/site-library/Rcpp/include/Rcpp/exceptions.h:195:17: note: declared here
inline void stop(const std::string& message) {
^
/usr/lib/R/etc/Makeconf:137: recipe for target 'parser2.o' failed
make: *** [parser2.o] Error 1
ERROR: compilation failed for package ‘roxygen2’
* removing ‘/usr/local/lib/R/site-library/roxygen2’
The downloaded source packages are in
‘/tmp/RtmpSn8jzt/downloaded_packages’
Warning message:
In install.packages("roxygen2", repos = "http://mirrors.dotsrc.org/cran/") :
installation of package ‘roxygen2’ had non-zero exit status
I tried several different repos, but result is always the same. Is it a problem with version that got published in repos? What else could I try?
Hadley noticed this problem with other packages and stated on a Github thread that the solution is to use the dev verstion of Rcpp, i.e.
install_github("RcppCore/Rcpp")
So, upgrade Rcpp then fully shutdown all RStudio and R processes, then restart and reinstall roxygen2.

Resources