Error: package or namespace load failed for ‘sf’ - r

I am trying to install the package sf, but no success.
Firstly, I thought the issue was related to the libraries GDAL, GEOS and PROJ, but all of them are installed and recognized by the installation process as showed below:
install.packages("sf")
Installing package into ‘/home/aliton/R/x86_64-pc-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/sf_0.9-8.tar.gz'
Content type 'application/x-gzip' length 4213253 bytes (4.0 MB)
==================================================
downloaded 4.0 MB
* installing *source* package ‘sf’ ...
** package ‘sf’ successfully unpacked and MD5 sums checked
** using staged installation
configure: CC: gcc -std=gnu99
configure: CXX: g++ -std=gnu++11
checking for gdal-config... /usr/local/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 2.0.1
checking GDAL version >= 2.0.1... yes
checking for gcc... gcc -std=gnu99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking gdal.h usability... yes
checking gdal.h presence... yes
checking for gdal.h... yes
checking GDAL: linking with --libs only... yes
checking GDAL: /usr/local/share/gdal/pcs.csv readable... yes
checking GDAL: checking whether PROJ is available for linking:... yes
checking GDAL: checking whether PROJ is available fur running:... yes
configure: GDAL: 2.0.1
checking proj.h usability... no
checking proj.h presence... no
checking for proj.h... no
checking proj_api.h usability... yes
checking proj_api.h presence... yes
checking for proj_api.h... yes
checking for pj_init_plus in -lproj... yes
checking PROJ: epsg found and readable... yes
checking for geos-config... /usr/bin/geos-config
checking geos-config usability... yes
configure: GEOS: 3.4.2
checking GEOS version >= 3.4.0... yes
checking geos_c.h usability... yes
checking geos_c.h presence... yes
checking for geos_c.h... yes
checking geos: linking with -L/usr/lib -lgeos_c... yes
configure: Package CPP flags: -I/usr/local/include -I/usr/include
configure: Package LIBS: -L/usr/local/lib -lgdal -lproj -L/usr/local/lib -lgdal -L/usr/lib -lgeos_c
configure: creating ./config.status
config.status: creating src/Makevars
** libs
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/local/include -I/usr/include -I"/home/aliton/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c RcppExports.cpp -o RcppExports.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/local/include -I/usr/include -I"/home/aliton/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c bbox.cpp -o bbox.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/local/include -I/usr/include -I"/home/aliton/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c gdal.cpp -o gdal.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/local/include -I/usr/include -I"/home/aliton/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c gdal_geom.cpp -o gdal_geom.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/local/include -I/usr/include -I"/home/aliton/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c gdal_read.cpp -o gdal_read.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/local/include -I/usr/include -I"/home/aliton/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c gdal_utils.cpp -o gdal_utils.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/local/include -I/usr/include -I"/home/aliton/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c gdal_write.cpp -o gdal_write.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/local/include -I/usr/include -I"/home/aliton/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c geos.cpp -o geos.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/local/include -I/usr/include -I"/home/aliton/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c hex.cpp -o hex.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/local/include -I/usr/include -I"/home/aliton/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c ops.cpp -o ops.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/local/include -I/usr/include -I"/home/aliton/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c polygonize.cpp -o polygonize.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/local/include -I/usr/include -I"/home/aliton/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c proj.cpp -o proj.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/local/include -I/usr/include -I"/home/aliton/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c proj_info.cpp -o proj_info.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/local/include -I/usr/include -I"/home/aliton/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c raster2sf.cpp -o raster2sf.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/local/include -I/usr/include -I"/home/aliton/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c sfg.cpp -o sfg.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/local/include -I/usr/include -I"/home/aliton/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -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/local/include -I/usr/include -I"/home/aliton/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c stars.cpp -o stars.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/local/include -I/usr/include -I"/home/aliton/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c wkb.cpp -o wkb.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/local/include -I/usr/include -I"/home/aliton/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c zm_range.cpp -o zm_range.o
g++ -std=gnu++11 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o sf.so RcppExports.o bbox.o gdal.o gdal_geom.o gdal_read.o gdal_utils.o gdal_write.o geos.o hex.o ops.o polygonize.o proj.o proj_info.o raster2sf.o sfg.o signed_area.o stars.o wkb.o zm_range.o -L/usr/local/lib -lgdal -lproj -L/usr/local/lib -lgdal -L/usr/lib -lgeos_c -L/usr/lib/R/lib -lR
installing to /home/aliton/R/x86_64-pc-linux-gnu-library/3.6/00LOCK-sf/00new/sf/libs
** R
** demo
** inst
** byte-compile and prepare package for lazy loading
in method for ‘dbWriteTable’ with signature ‘"PostgreSQLConnection","character","sf"’: no definition for class “PostgreSQLConnection”
in method for ‘dbDataType’ with signature ‘"PostgreSQLConnection","sf"’: no definition for class “PostgreSQLConnection”
in method for ‘coerce’ with signature ‘"Spatial","sf"’: no definition for class “Spatial”
in method for ‘coerce’ with signature ‘"Spatial","sfc"’: no definition for class “Spatial”
in method for ‘coerce’ with signature ‘"sf","Spatial"’: no definition for class “Spatial”
in method for ‘coerce’ with signature ‘"sfc","Spatial"’: no definition for class “Spatial”
in method for ‘coerce’ with signature ‘"XY","Spatial"’: no definition for class “Spatial”
in method for ‘coerce’ with signature ‘"crs","CRS"’: no definition for class “CRS”
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘sf’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/home/aliton/R/x86_64-pc-linux-gnu-library/3.6/00LOCK-sf/00new/sf/libs/sf.so':
/home/aliton/R/x86_64-pc-linux-gnu-library/3.6/00LOCK-sf/00new/sf/libs/sf.so: undefined symbol: _Z17CPL_gdalrasterizeN4Rcpp6VectorILi16ENS_15PreserveStorageEEES2_S2_S2_S2_bb
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/aliton/R/x86_64-pc-linux-gnu-library/3.6/sf’
Warning in install.packages :
installation of package ‘sf’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpLiPeTF/downloaded_packages’
It seems that it can't load a temporary file (sf.so) which itself is supposed to create.
─ Session info ─────────────────────────────────────────────────────────────────
setting value
version R version 3.6.3 (2020-02-29)
os Ubuntu 14.04.5 LTS
system x86_64, linux-gnu
ui RStudio
language en_US
collate en_US.UTF-8
ctype en_US.UTF-8
tz America/Maceio
date 2021-04-16
How to make it work?
I appreciate any help.
ADDITIONAL INFO
I have rgdal package installed and it also shows that GDAL is installed and linked with GEOS.
library(rgdal)
Loading required package: sp
rgdal: version: 1.5-23, (SVN revision 1121)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 2.0.1, released 2015/09/15
Path to GDAL shared files: /usr/local/share/gdal
GDAL binary built with GEOS: TRUE
Loaded PROJ runtime: Rel. 4.8.0, 6 March 2012, [PJ_VERSION: 480]
Path to PROJ shared files: (autodetected)
Linking to sp version:1.4-5
I don't know how to verify how many versions of GDAL, GEOS and/or PROJ I have installed, but it seems that I have multiple versions installed and this may be causing the issue. I found this command on github issues #815
aliton#aliton:/usr/share/proj$ ldconfig -p | grep gdal
libgdal.so.20 (libc6,x86-64) => /usr/local/lib/libgdal.so.20
libgdal.so.1 (libc6,x86-64) => /usr/lib/libgdal.so.1
libgdal.so (libc6,x86-64) => /usr/local/lib/libgdal.so
libgdal.so (libc6,x86-64) => /usr/lib/libgdal.so
aliton#aliton:/usr/share/proj$ ldconfig -p | grep geos
libgeos_c.so.1 (libc6,x86-64) => /usr/lib/libgeos_c.so.1
libgeos_c.so (libc6,x86-64) => /usr/lib/libgeos_c.so
libgeos-3.4.2.so (libc6,x86-64) => /usr/lib/libgeos-3.4.2.so
Before finishing the installation with an error, I copied the whole "sf" folder and typed the following command:
aliton#aliton:~$ ldd /home/aliton/installers/00LOCK-sf/00new/sf/libs/sf.so
linux-vdso.so.1 => (0x00007fff7c632000)
libgdal.so.20 => /usr/local/lib/libgdal.so.20 (0x00007fe196e10000)
libproj.so.0 => /usr/lib/libproj.so.0 (0x00007fe196bbe000)
libgeos_c.so.1 => /usr/lib/libgeos_c.so.1 (0x00007fe19699a000)
libR.so => /usr/lib/libR.so (0x00007fe19631a000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fe196004000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fe195cfe000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fe195ae5000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe19571c000)
libsqlite3.so.0 => /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 (0x00007fe195463000)
libodbc.so.1 => /usr/lib/x86_64-linux-gnu/libodbc.so.1 (0x00007fe1951fb000)
libodbcinst.so.1 => /usr/lib/x86_64-linux-gnu/libodbcinst.so.1 (0x00007fe194fe9000)
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007fe194dbf000)
libxerces-c-3.1.so => /usr/lib/x86_64-linux-gnu/libxerces-c-3.1.so (0x00007fe194836000)
libjasper.so.1 => /usr/lib/x86_64-linux-gnu/libjasper.so.1 (0x00007fe1945de000)
libnetcdf.so.7 => /usr/lib/libnetcdf.so.7 (0x00007fe1942a1000)
libhdf5.so.7 => /usr/lib/x86_64-linux-gnu/libhdf5.so.7 (0x00007fe193e0c000)
libmfhdfalt.so.0 => /usr/lib/libmfhdfalt.so.0 (0x00007fe193bdb000)
libdfalt.so.0 => /usr/lib/libdfalt.so.0 (0x00007fe1938f5000)
libgif.so.4 => /usr/lib/x86_64-linux-gnu/libgif.so.4 (0x00007fe1936eb000)
libjpeg.so.8 => /usr/lib/x86_64-linux-gnu/libjpeg.so.8 (0x00007fe193496000)
libtiff.so.5 => /usr/lib/x86_64-linux-gnu/libtiff.so.5 (0x00007fe193223000)
libpng12.so.0 => /lib/x86_64-linux-gnu/libpng12.so.0 (0x00007fe192ffc000)
libpq.so.5 => /usr/lib/libpq.so.5 (0x00007fe192dcd000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fe192bb4000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fe192995000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fe192791000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fe192553000)
libcurl-gnutls.so.4 => /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4 (0x00007fe1922f0000)
libxml2.so.2 => /usr/lib/x86_64-linux-gnu/libxml2.so.2 (0x00007fe191f89000)
libgeos-3.4.2.so => /usr/lib/libgeos-3.4.2.so (0x00007fe191c04000)
libblas.so.3 => /usr/lib/libblas.so.3 (0x00007fe191638000)
libreadline.so.6 => /lib/x86_64-linux-gnu/libreadline.so.6 (0x00007fe1913f2000)
liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007fe1911cf000)
libbz2.so.1.0 => /lib/x86_64-linux-gnu/libbz2.so.1.0 (0x00007fe190fbf000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fe190db7000)
libgomp.so.1 => /usr/lib/x86_64-linux-gnu/libgomp.so.1 (0x00007fe190b87000)
/lib64/ld-linux-x86-64.so.2 (0x00007fe1980d2000)
libltdl.so.7 => /usr/lib/x86_64-linux-gnu/libltdl.so.7 (0x00007fe19097d000)
libhdf5_hl.so.7 => /usr/lib/x86_64-linux-gnu/libhdf5_hl.so.7 (0x00007fe19074c000)
libjbig.so.0 => /usr/lib/x86_64-linux-gnu/libjbig.so.0 (0x00007fe19053e000)
libssl.so.1.0.0 => /lib/x86_64-linux-gnu/libssl.so.1.0.0 (0x00007fe1902de000)
libcrypto.so.1.0.0 => /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007fe18ff02000)
libkrb5.so.3 => /usr/lib/x86_64-linux-gnu/libkrb5.so.3 (0x00007fe18fc37000)
libcom_err.so.2 => /lib/x86_64-linux-gnu/libcom_err.so.2 (0x00007fe18fa32000)
libgssapi_krb5.so.2 => /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2 (0x00007fe18f7eb000)
libldap_r-2.4.so.2 => /usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2 (0x00007fe18f59a000)
libidn.so.11 => /usr/lib/x86_64-linux-gnu/libidn.so.11 (0x00007fe18f366000)
librtmp.so.0 => /usr/lib/x86_64-linux-gnu/librtmp.so.0 (0x00007fe18f14c000)
libgcrypt.so.11 => /lib/x86_64-linux-gnu/libgcrypt.so.11 (0x00007fe18eecc000)
libgnutls.so.26 => /usr/lib/x86_64-linux-gnu/libgnutls.so.26 (0x00007fe18ec0c000)
liblber-2.4.so.2 => /usr/lib/x86_64-linux-gnu/liblber-2.4.so.2 (0x00007fe18e9fd000)
libgfortran.so.3 => /usr/lib/x86_64-linux-gnu/libgfortran.so.3 (0x00007fe18e6d5000)
libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007fe18e4ac000)
libk5crypto.so.3 => /usr/lib/x86_64-linux-gnu/libk5crypto.so.3 (0x00007fe18e27c000)
libkrb5support.so.0 => /usr/lib/x86_64-linux-gnu/libkrb5support.so.0 (0x00007fe18e071000)
libkeyutils.so.1 => /lib/x86_64-linux-gnu/libkeyutils.so.1 (0x00007fe18de6d000)
libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007fe18dc51000)
libsasl2.so.2 => /usr/lib/x86_64-linux-gnu/libsasl2.so.2 (0x00007fe18da36000)
libgssapi.so.3 => /usr/lib/x86_64-linux-gnu/libgssapi.so.3 (0x00007fe18d7f8000)
libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007fe18d5f2000)
libtasn1.so.6 => /usr/lib/x86_64-linux-gnu/libtasn1.so.6 (0x00007fe18d3de000)
libp11-kit.so.0 => /usr/lib/x86_64-linux-gnu/libp11-kit.so.0 (0x00007fe18d19b000)
libquadmath.so.0 => /usr/lib/x86_64-linux-gnu/libquadmath.so.0 (0x00007fe18cf5b000)
libheimntlm.so.0 => /usr/lib/x86_64-linux-gnu/libheimntlm.so.0 (0x00007fe18cd51000)
libkrb5.so.26 => /usr/lib/x86_64-linux-gnu/libkrb5.so.26 (0x00007fe18cac9000)
libasn1.so.8 => /usr/lib/x86_64-linux-gnu/libasn1.so.8 (0x00007fe18c828000)
libhcrypto.so.4 => /usr/lib/x86_64-linux-gnu/libhcrypto.so.4 (0x00007fe18c5f4000)
libroken.so.18 => /usr/lib/x86_64-linux-gnu/libroken.so.18 (0x00007fe18c3df000)
libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007fe18c1d7000)
libwind.so.0 => /usr/lib/x86_64-linux-gnu/libwind.so.0 (0x00007fe18bfad000)
libheimbase.so.1 => /usr/lib/x86_64-linux-gnu/libheimbase.so.1 (0x00007fe18bd9f000)
libhx509.so.5 => /usr/lib/x86_64-linux-gnu/libhx509.so.5 (0x00007fe18bb56000)
libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007fe18b91c000)
Somehow I managed to identify two versions of GDAL with the following command:
aliton#aliton:~$ locate gdal-config
/usr/bin/gdal-config
/usr/local/bin/gdal-config
/usr/share/man/man1/gdal-config.1.gz
Where /usr/bin/gdal-config is version 1.10.1 and /usr/local/bin/gdal-config is version 2.0.1
> install.packages("sf", configure.args = "--with-gdal-config=/usr/bin/gdal-config")
Installing package into ‘/home/aliton/R/x86_64-pc-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/sf_0.9-8.tar.gz'
Content type 'application/x-gzip' length 4213253 bytes (4.0 MB)
==================================================
downloaded 4.0 MB
* installing *source* package ‘sf’ ...
** package ‘sf’ successfully unpacked and MD5 sums checked
** using staged installation
configure: CC: gcc -std=gnu99
configure: CXX: g++ -std=gnu++11
configure: gdal-config set to /usr/bin/gdal-config
checking gdal-config exists... yes
checking gdal-config executable... yes
checking gdal-config usability... yes
configure: GDAL: 1.10.1
checking GDAL version >= 2.0.1... no
configure: error: sf is not compatible with GDAL versions below 2.0.1
ERROR: configuration failed for package ‘sf’
* removing ‘/home/aliton/R/x86_64-pc-linux-gnu-library/3.6/sf’
Warning in install.packages :
installation of package ‘sf’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmplreAgs/downloaded_packages’
I also found a way to find the symbols in the /usr/local/lib/libgdal.so and indeed there is no symbol named _Z17CPL_gdalrasterizeN4Rcpp6VectorILi16ENS_15PreserveStorageEEES2_S2_S2_S2_bb.
The only similar symbols I found was:
aliton#aliton:~$ nm -g /usr/local/lib/libgdal.so | grep _Z17CPL
000000000070e710 T _Z17CPLHaveRuntimeAVXv
000000000070e700 T _Z17CPLHaveRuntimeSSEv
000000000042e8e0 T _Z17CPLHTTPFetchMultiP14CPLHTTPRequestiPKPKc
00000000006cc240 T _Z17CPLHTTPSetOptionsPvPPc
00000000006d67d0 T _Z17CPLReinitAllMutexv
Compared to:
aliton#aliton:~$ nm -g /home/aliton/installers/00LOCK-sf/00new/sf/libs/sf.so | grep _Z17CPL
000000000004e0f0 T _Z17CPL_gdalnearblackN4Rcpp6VectorILi16ENS_15PreserveStorageEEES2_S2_S2_S2_
U _Z17CPL_gdalnearblackN4Rcpp6VectorILi16ENS_15PreserveStorageEEES2_S2_S2_S2_b
000000000004e0a0 T _Z17CPL_gdalrasterizeN4Rcpp6VectorILi16ENS_15PreserveStorageEEES2_S2_S2_S2_b
U _Z17CPL_gdalrasterizeN4Rcpp6VectorILi16ENS_15PreserveStorageEEES2_S2_S2_S2_bb
000000000004e0b0 T _Z17CPL_gdaltranslateN4Rcpp6VectorILi16ENS_15PreserveStorageEEES2_S2_S2_
U _Z17CPL_gdaltranslateN4Rcpp6VectorILi16ENS_15PreserveStorageEEES2_S2_S2_b
0000000000055cd0 T _Z17CPL_geos_is_emptyN4Rcpp6VectorILi19ENS_15PreserveStorageEEE
00000000000558d0 T _Z17CPL_geos_is_validN4Rcpp6VectorILi19ENS_15PreserveStorageEEEb
0000000000064e00 T _Z17CPL_get_pipelinesN4Rcpp6VectorILi16ENS_15PreserveStorageEEES2_NS0_ILi14ES1_EES2_S2_dbb
00000000000643b0 T _Z17CPL_proj_is_validSs
0000000000041a80 T _Z17CPL_wrap_datelineN4Rcpp6VectorILi19ENS_15PreserveStorageEEENS0_ILi16ES1_EEb

I ran into the same problem as you. The solution I found was to restart R and run the following commands (possibly after removing the SF package):
install.packages("Rcpp")
library(Rcpp)
install.packages("sf")
library(sf)

Related

R - Installing package "xlsx"

I'm trying to install the package "xlsx" in RStudio. I am using Ubuntu 20.04 and I am new to programming. I uses the code
install.packages("xlsx")
While the installation process I got warnings:
warning: [options] bootstrap class path not set in conjunction with -source 6
warning: [options] source value 6 is obsolete and will be removed in a future release
warning: [options] target value 1.6 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
After that some things are not found:
/usr/bin/ld: -lpcre2-8 kann nicht gefunden werden
/usr/bin/ld: -llzma kann nicht gefunden werden
/usr/bin/ld: -lbz2 kann nicht gefunden werden
/usr/bin/ld: -lz kann nicht gefunden werden
And the installation process stopps.
The whole code is here:
install.packages("xlsx")
Installiere Paket nach ‘/home/carla/R/x86_64-pc-linux-gnu-library/4.1’
(da ‘lib’ nicht spezifiziert)
installiere auch Abhängigkeiten ‘rJava’, ‘xlsxjars’
versuche URL 'https://cloud.r-project.org/src/contrib/rJava_1.0-6.tar.gz'
Content type 'application/x-gzip' length 1047062 bytes (1022 KB)
==================================================
downloaded 1022 KB
versuche URL 'https://cloud.r-project.org/src/contrib/xlsxjars_0.6.1.tar.gz'
Content type 'application/x-gzip' length 9477071 bytes (9.0 MB)
==================================================
downloaded 9.0 MB
versuche URL 'https://cloud.r-project.org/src/contrib/xlsx_0.6.5.tar.gz'
Content type 'application/x-gzip' length 489493 bytes (478 KB)
==================================================
downloaded 478 KB
* installing *source* package ‘rJava’ ...
** package ‘rJava’ successfully unpacked and MD5 sums checked
** using staged installation
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for string.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking whether time.h and sys/time.h may both be included... yes
configure: checking whether gcc supports static inline...
yes
checking whether setjmp.h is POSIX.1 compatible... yes
checking whether sigsetjmp is declared... yes
checking whether siglongjmp is declared... yes
checking Java support in R... present:
interpreter : '/usr/lib/jvm/default-java/bin/java'
archiver : '/usr/lib/jvm/default-java/bin/jar'
compiler : '/usr/lib/jvm/default-java/bin/javac'
header prep.: ''
cpp flags : '-I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux'
java libs : '-L/usr/lib/jvm/default-java/lib/server -ljvm'
checking whether Java run-time works... yes
checking whether -Xrs is supported... yes
checking whether -Xrs will be used... yes
checking whether JVM will be loaded dynamically... no
checking whether JNI programs can be compiled... yes
checking whether JNI programs run... yes
checking JNI data types... ok
checking whether JRI should be compiled (autodetect)... yes
checking whether debugging output should be enabled... no
checking whether memory profiling is desired... no
checking whether threads support is requested... no
checking whether callbacks support is requested... no
checking whether JNI cache support is requested... no
checking whether headless init is enabled... no
checking whether JRI is requested... yes
configure: creating ./config.status
config.status: creating src/Makevars
config.status: creating R/zzz.R
config.status: creating src/config.h
=== configuring in jri (/tmp/Rtmpbi2fIb/R.INSTALLaa4513637492/rJava/jri)
configure: running /bin/bash ./configure --disable-option-checking '--prefix=/usr/local' --cache-file=/dev/null --srcdir=.
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for sys/time.h... yes
checking for sys/types.h... (cached) yes
checking for sys/select.h... yes
checking Java version... 11.0.14.1
checking Java compatibility version (integer)... 11
checking whether actually works... no
checking whether javah was replaced by javac -h... yes
checking for target flags... -h . -target 1.6 -source 1.6
checking whether Java interpreter works... checking whether JNI programs can be compiled... yes
checking whether JNI programs can be run... yes
checking JNI data types... ok
checking whether Rinterface.h exports R_CStackXXX variables... yes
checking whether Rinterface.h exports R_SignalHandlers... yes
configure: creating ./config.status
config.status: creating src/Makefile
config.status: creating Makefile
config.status: creating run
config.status: creating src/config.h
** libs
gcc -I"/usr/share/R/include" -DNDEBUG -I. -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux -fpic -g -O2 -fdebug-prefix-map=/build/r-base-lENDSu/r-base-4.1.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c Rglue.c -o Rglue.o
gcc -I"/usr/share/R/include" -DNDEBUG -I. -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux -fpic -g -O2 -fdebug-prefix-map=/build/r-base-lENDSu/r-base-4.1.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c arrayc.c -o arrayc.o
gcc -I"/usr/share/R/include" -DNDEBUG -I. -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux -fpic -g -O2 -fdebug-prefix-map=/build/r-base-lENDSu/r-base-4.1.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c callJNI.c -o callJNI.o
gcc -I"/usr/share/R/include" -DNDEBUG -I. -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux -fpic -g -O2 -fdebug-prefix-map=/build/r-base-lENDSu/r-base-4.1.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c callback.c -o callback.o
gcc -I"/usr/share/R/include" -DNDEBUG -I. -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux -fpic -g -O2 -fdebug-prefix-map=/build/r-base-lENDSu/r-base-4.1.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c fields.c -o fields.o
gcc -I"/usr/share/R/include" -DNDEBUG -I. -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux -fpic -g -O2 -fdebug-prefix-map=/build/r-base-lENDSu/r-base-4.1.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c init.c -o init.o
gcc -I"/usr/share/R/include" -DNDEBUG -I. -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux -fpic -g -O2 -fdebug-prefix-map=/build/r-base-lENDSu/r-base-4.1.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c jri_glue.c -o jri_glue.o
gcc -I"/usr/share/R/include" -DNDEBUG -I. -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux -fpic -g -O2 -fdebug-prefix-map=/build/r-base-lENDSu/r-base-4.1.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c loader.c -o loader.o
gcc -I"/usr/share/R/include" -DNDEBUG -I. -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux -fpic -g -O2 -fdebug-prefix-map=/build/r-base-lENDSu/r-base-4.1.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c otables.c -o otables.o
gcc -I"/usr/share/R/include" -DNDEBUG -I. -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux -fpic -g -O2 -fdebug-prefix-map=/build/r-base-lENDSu/r-base-4.1.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c rJava.c -o rJava.o
gcc -I"/usr/share/R/include" -DNDEBUG -I. -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux -fpic -g -O2 -fdebug-prefix-map=/build/r-base-lENDSu/r-base-4.1.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c registration.c -o registration.o
gcc -I"/usr/share/R/include" -DNDEBUG -I. -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux -fpic -g -O2 -fdebug-prefix-map=/build/r-base-lENDSu/r-base-4.1.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c tools.c -o tools.o
gcc -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o rJava.so Rglue.o arrayc.o callJNI.o callback.o fields.o init.o jri_glue.o loader.o otables.o rJava.o registration.o tools.o -L/usr/lib/jvm/default-java/lib/server -ljvm -L/usr/lib/R/lib -lR
(cd ../jri && make)
make[1]: Verzeichnis „/tmp/Rtmpbi2fIb/R.INSTALLaa4513637492/rJava/jri“ wird betreten
make -C src JRI.jar
make[2]: Verzeichnis „/tmp/Rtmpbi2fIb/R.INSTALLaa4513637492/rJava/jri/src“ wird betreten
/usr/lib/jvm/default-java/bin/javac -h . -target 1.6 -source 1.6 -d . ../package-info.java ../RFactor.java ../REXP.java ../Rengine.java ../RList.java ../Mutex.java ../RConsoleOutputStream.java ../RMainLoopCallbacks.java ../RVector.java ../RBool.java
warning: [options] bootstrap class path not set in conjunction with -source 6
warning: [options] source value 6 is obsolete and will be removed in a future release
warning: [options] target value 1.6 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
4 warnings
if [ -n "" ]; then -d . -classpath . org.rosuda.JRI.Rengine; fi
gcc -c -o Rengine.o Rengine.c -g -Iinclude -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -DHAVE_CONFIG_H -g -O2 -fdebug-prefix-map=/build/r-base-lENDSu/r-base-4.1.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux -fpic -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux -I/usr/share/R/include -I/usr/share/R/include
gcc -c -o jri.o jri.c -g -Iinclude -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -DHAVE_CONFIG_H -g -O2 -fdebug-prefix-map=/build/r-base-lENDSu/r-base-4.1.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux -fpic -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux -I/usr/share/R/include -I/usr/share/R/include
gcc -c -o Rcallbacks.o Rcallbacks.c -g -Iinclude -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -DHAVE_CONFIG_H -g -O2 -fdebug-prefix-map=/build/r-base-lENDSu/r-base-4.1.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux -fpic -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux -I/usr/share/R/include -I/usr/share/R/include
gcc -c -o Rinit.o Rinit.c -g -Iinclude -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -DHAVE_CONFIG_H -g -O2 -fdebug-prefix-map=/build/r-base-lENDSu/r-base-4.1.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux -fpic -I/usr/share/R/include -I/usr/share/R/include
gcc -c -o globals.o globals.c -g -Iinclude -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -DHAVE_CONFIG_H -g -O2 -fdebug-prefix-map=/build/r-base-lENDSu/r-base-4.1.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux -fpic -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux
gcc -c -o rjava.o rjava.c -g -Iinclude -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -DHAVE_CONFIG_H -g -O2 -fdebug-prefix-map=/build/r-base-lENDSu/r-base-4.1.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux -fpic -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux
gcc -o libjri.so Rengine.o jri.o Rcallbacks.o Rinit.o globals.o rjava.o -shared -L/usr/lib/jvm/default-java/lib/server -ljvm -Wl,--export-dynamic -fopenmp -Wl,-Bsymbolic-functions -Wl,-z,relro -L/usr/lib/R/lib -lR -lpcre2-8 -llzma -lbz2 -lz -lrt -ldl -lm -licuuc -licui18n
/usr/bin/ld: -lpcre2-8 kann nicht gefunden werden
/usr/bin/ld: -llzma kann nicht gefunden werden
/usr/bin/ld: -lbz2 kann nicht gefunden werden
/usr/bin/ld: -lz kann nicht gefunden werden
collect2: error: ld returned 1 exit status
make[2]: Verzeichnis „/tmp/Rtmpbi2fIb/R.INSTALLaa4513637492/rJava/jri/src“ wird verlassen
make[2]: *** [Makefile.all:37: libjri.so] Fehler 1
make[1]: *** [Makefile.all:19: src/JRI.jar] Fehler 2
make[1]: Verzeichnis „/tmp/Rtmpbi2fIb/R.INSTALLaa4513637492/rJava/jri“ wird verlassen
make: *** [Makevars:14: jri] Fehler 2
ERROR: compilation failed for package ‘rJava’
* removing ‘/home/carla/R/x86_64-pc-linux-gnu-library/4.1/rJava’
Warning in install.packages :
installation of package ‘rJava’ had non-zero exit status
ERROR: dependency ‘rJava’ is not available for package ‘xlsxjars’
* removing ‘/home/carla/R/x86_64-pc-linux-gnu-library/4.1/xlsxjars’
Warning in install.packages :
installation of package ‘xlsxjars’ had non-zero exit status
ERROR: dependencies ‘rJava’, ‘xlsxjars’ are not available for package ‘xlsx’
* removing ‘/home/carla/R/x86_64-pc-linux-gnu-library/4.1/xlsx’
Warning in install.packages :
installation of package ‘xlsx’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpYSDmLA/downloaded_packages’
I tried to first install "rJava" but there were also the same warnings and it stopped at the same part.
And now I don't know what to do, maybe some of you can help me?

Can't install package lwgeom in R 3.5.2

I'm trying to install, in R 3.5.2 (under Debian 9), package lwgeom, which is a dependency of sf, which is a dependency of spider, the final desired package. But I got a few errors:
> install.packages('lwgeom',depend=T)
Installing package into ‘/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5’
(as ‘lib’ is unspecified)
also installing the dependency ‘sf’
trying URL 'https://cloud.r-project.org/src/contrib/sf_0.7-2.tar.gz'
Content type 'application/x-gzip' length 8330773 bytes (7.9 MB)
==================================================
downloaded 7.9 MB
trying URL 'https://cloud.r-project.org/src/contrib/lwgeom_0.1-5.tar.gz'
Content type 'application/x-gzip' length 439764 bytes (429 KB)
==================================================
downloaded 429 KB
* installing *source* package ‘sf’ ...
** package ‘sf’ successfully unpacked and MD5 sums checked
configure: CC: gcc -std=gnu99
configure: CXX: g++ -std=gnu++11
checking for gdal-config... /usr/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 2.1.2
checking GDAL version >= 2.0.0... yes
checking for gcc... gcc -std=gnu99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking gdal.h usability... yes
checking gdal.h presence... yes
checking for gdal.h... yes
checking GDAL: linking with --libs only... yes
checking GDAL: /usr/share/gdal/2.1/pcs.csv readable... yes
checking GDAL: checking whether PROJ is available for linking:... yes
checking GDAL: checking whether PROJ is available fur running:... yes
configure: pkg-config proj exists, will use it
checking proj_api.h usability... yes
checking proj_api.h presence... yes
checking for proj_api.h... yes
configure: PROJ: 4.9.3
checking for pj_init_plus in -lproj... yes
checking PROJ: epsg found and readable... yes
checking PROJ: conus found and readable... yes
checking for geos-config... /usr/local/bin/geos-config
checking geos-config usability... yes
configure: GEOS: 3.7.1
checking GEOS version >= 3.4.0... yes
checking geos_c.h usability... yes
checking geos_c.h presence... yes
checking for geos_c.h... yes
checking geos: linking with -L/usr/local/lib -lgeos_c... yes
configure: Package CPP flags: -I/usr/include/gdal -I/usr/local/include
configure: Package LIBS: -lproj -L/usr/lib -lgdal -L/usr/local/lib -lgeos_c
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/usr/local/include -I"/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/stretch/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++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal -I/usr/local/include -I"/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/stretch/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c bbox.cpp -o bbox.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal -I/usr/local/include -I"/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/stretch/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c gdal.cpp -o gdal.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal -I/usr/local/include -I"/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/stretch/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c gdal_geom.cpp -o gdal_geom.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal -I/usr/local/include -I"/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/stretch/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c gdal_read.cpp -o gdal_read.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal -I/usr/local/include -I"/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/stretch/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c gdal_utils.cpp -o gdal_utils.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal -I/usr/local/include -I"/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/stretch/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c gdal_write.cpp -o gdal_write.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal -I/usr/local/include -I"/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/stretch/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c geos.cpp -o geos.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal -I/usr/local/include -I"/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/stretch/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c hex.cpp -o hex.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal -I/usr/local/include -I"/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/stretch/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c polygonize.cpp -o polygonize.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal -I/usr/local/include -I"/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/stretch/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c proj.cpp -o proj.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal -I/usr/local/include -I"/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/stretch/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c raster2sf.cpp -o raster2sf.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal -I/usr/local/include -I"/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/stretch/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c sfg.cpp -o sfg.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal -I/usr/local/include -I"/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/stretch/r-base-3.5.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/local/include -I"/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/stretch/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c stars.cpp -o stars.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal -I/usr/local/include -I"/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/stretch/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c wkb.cpp -o wkb.o
g++ -std=gnu++11 -shared -L/usr/lib/R/lib -Wl,-z,relro -o sf.so RcppExports.o bbox.o gdal.o gdal_geom.o gdal_read.o gdal_utils.o gdal_write.o geos.o hex.o polygonize.o proj.o raster2sf.o sfg.o signed_area.o stars.o wkb.o -lproj -L/usr/lib -lgdal -L/usr/local/lib -lgeos_c -L/usr/lib/R/lib -lR
installing to /home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/sf/libs
** R
** data
** demo
** inst
** byte-compile and prepare package for lazy loading
in method for ‘dbWriteTable’ with signature ‘"PostgreSQLConnection","character","sf"’: no definition for class “PostgreSQLConnection”
in method for ‘dbDataType’ with signature ‘"PostgreSQLConnection","sf"’: no definition for class “PostgreSQLConnection”
in method for ‘coerce’ with signature ‘"Spatial","sf"’: no definition for class “Spatial”
in method for ‘coerce’ with signature ‘"Spatial","sfc"’: no definition for class “Spatial”
in method for ‘coerce’ with signature ‘"sf","Spatial"’: no definition for class “Spatial”
in method for ‘coerce’ with signature ‘"sfc","Spatial"’: no definition for class “Spatial”
in method for ‘coerce’ with signature ‘"XY","Spatial"’: no definition for class “Spatial”
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error: package or namespace load failed for ‘sf’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/sf/libs/sf.so':
/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/sf/libs/sf.so: undefined symbol: GEOSFrechetDistanceDensify_r
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/sf’
Warning in install.packages :
installation of package ‘sf’ had non-zero exit status
ERROR: dependency ‘sf’ is not available for package ‘lwgeom’
* removing ‘/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/lwgeom’
Warning in install.packages :
installation of package ‘lwgeom’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmptKPuTu/downloaded_packages’
The lines with errors are:
in method for ‘dbWriteTable’ with signature ‘"PostgreSQLConnection","character","sf"’: no definition for class “PostgreSQLConnection”
in method for ‘dbDataType’ with signature ‘"PostgreSQLConnection","sf"’: no definition for class “PostgreSQLConnection”
I installed the packages RSQLite and RPostgreSQL, but this didn't solved it.
in method for ‘coerce’ with signature ‘"Spatial","sf"’: no definition for class “Spatial”
in method for ‘coerce’ with signature ‘"Spatial","sfc"’: no definition for class “Spatial”
in method for ‘coerce’ with signature ‘"sf","Spatial"’: no definition for class “Spatial”
in method for ‘coerce’ with signature ‘"sfc","Spatial"’: no definition for class “Spatial”
in method for ‘coerce’ with signature ‘"XY","Spatial"’: no definition for class “Spatial”
I have no idea how to solve these, but I have the following packages installed in Debian:
libgdal-dev is already the newest version (2.1.2+dfsg-5).
libgeos-dev is already the newest version (3.5.1-3).
libproj-dev is already the newest version (4.9.3-1).
libudunits2-dev is already the newest version (2.2.20-1+b1).
The last important error:
ERROR: dependency ‘sf’ is not available for package ‘lwgeom’
But if I try to install sf, I got the following error:
> install.packages('sf',depend=T)
Installing package into ‘/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5’
(as ‘lib’ is unspecified)
also installing the dependencies ‘tmaptools’, ‘lwgeom’, ‘mapview’, ‘stars’, ‘tmap’
trying URL 'https://cloud.r-project.org/src/contrib/tmaptools_2.0-1.tar.gz'
Content type 'application/x-gzip' length 84292 bytes (82 KB)
==================================================
downloaded 82 KB
trying URL 'https://cloud.r-project.org/src/contrib/lwgeom_0.1-5.tar.gz'
Content type 'application/x-gzip' length 439764 bytes (429 KB)
==================================================
downloaded 429 KB
trying URL 'https://cloud.r-project.org/src/contrib/mapview_2.6.3.tar.gz'
Content type 'application/x-gzip' length 2016015 bytes (1.9 MB)
==================================================
downloaded 1.9 MB
trying URL 'https://cloud.r-project.org/src/contrib/stars_0.2-0.tar.gz'
Content type 'application/x-gzip' length 5999356 bytes (5.7 MB)
==================================================
downloaded 5.7 MB
trying URL 'https://cloud.r-project.org/src/contrib/tmap_2.2.tar.gz'
Content type 'application/x-gzip' length 2900602 bytes (2.8 MB)
==================================================
downloaded 2.8 MB
trying URL 'https://cloud.r-project.org/src/contrib/sf_0.7-2.tar.gz'
Content type 'application/x-gzip' length 8330773 bytes (7.9 MB)
==================================================
downloaded 7.9 MB
* installing *source* package ‘sf’ ...
** package ‘sf’ successfully unpacked and MD5 sums checked
configure: CC: gcc -std=gnu99
configure: CXX: g++ -std=gnu++11
checking for gdal-config... /usr/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 2.1.2
checking GDAL version >= 2.0.0... yes
checking for gcc... gcc -std=gnu99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking gdal.h usability... yes
checking gdal.h presence... yes
checking for gdal.h... yes
checking GDAL: linking with --libs only... yes
checking GDAL: /usr/share/gdal/2.1/pcs.csv readable... yes
checking GDAL: checking whether PROJ is available for linking:... yes
checking GDAL: checking whether PROJ is available fur running:... yes
configure: pkg-config proj exists, will use it
checking proj_api.h usability... yes
checking proj_api.h presence... yes
checking for proj_api.h... yes
configure: PROJ: 4.9.3
checking for pj_init_plus in -lproj... yes
checking PROJ: epsg found and readable... yes
checking PROJ: conus found and readable... yes
checking for geos-config... /usr/local/bin/geos-config
checking geos-config usability... yes
configure: GEOS: 3.7.1
checking GEOS version >= 3.4.0... yes
checking geos_c.h usability... yes
checking geos_c.h presence... yes
checking for geos_c.h... yes
checking geos: linking with -L/usr/local/lib -lgeos_c... yes
configure: Package CPP flags: -I/usr/include/gdal -I/usr/local/include
configure: Package LIBS: -lproj -L/usr/lib -lgdal -L/usr/local/lib -lgeos_c
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/usr/local/include -I"/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/stretch/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++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal -I/usr/local/include -I"/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/stretch/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c bbox.cpp -o bbox.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal -I/usr/local/include -I"/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/stretch/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c gdal.cpp -o gdal.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal -I/usr/local/include -I"/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/stretch/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c gdal_geom.cpp -o gdal_geom.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal -I/usr/local/include -I"/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/stretch/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c gdal_read.cpp -o gdal_read.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal -I/usr/local/include -I"/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/stretch/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c gdal_utils.cpp -o gdal_utils.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal -I/usr/local/include -I"/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/stretch/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c gdal_write.cpp -o gdal_write.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal -I/usr/local/include -I"/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/stretch/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c geos.cpp -o geos.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal -I/usr/local/include -I"/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/stretch/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c hex.cpp -o hex.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal -I/usr/local/include -I"/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/stretch/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c polygonize.cpp -o polygonize.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal -I/usr/local/include -I"/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/stretch/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c proj.cpp -o proj.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal -I/usr/local/include -I"/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/stretch/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c raster2sf.cpp -o raster2sf.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal -I/usr/local/include -I"/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/stretch/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c sfg.cpp -o sfg.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal -I/usr/local/include -I"/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/stretch/r-base-3.5.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/local/include -I"/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/stretch/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c stars.cpp -o stars.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/gdal -I/usr/local/include -I"/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/home/jranke/git/r-backports/stretch/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c wkb.cpp -o wkb.o
g++ -std=gnu++11 -shared -L/usr/lib/R/lib -Wl,-z,relro -o sf.so RcppExports.o bbox.o gdal.o gdal_geom.o gdal_read.o gdal_utils.o gdal_write.o geos.o hex.o polygonize.o proj.o raster2sf.o sfg.o signed_area.o stars.o wkb.o -lproj -L/usr/lib -lgdal -L/usr/local/lib -lgeos_c -L/usr/lib/R/lib -lR
installing to /home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/sf/libs
** R
** data
** demo
** inst
** byte-compile and prepare package for lazy loading
in method for ‘dbWriteTable’ with signature ‘"PostgreSQLConnection","character","sf"’: no definition for class “PostgreSQLConnection”
in method for ‘dbDataType’ with signature ‘"PostgreSQLConnection","sf"’: no definition for class “PostgreSQLConnection”
in method for ‘coerce’ with signature ‘"Spatial","sf"’: no definition for class “Spatial”
in method for ‘coerce’ with signature ‘"Spatial","sfc"’: no definition for class “Spatial”
in method for ‘coerce’ with signature ‘"sf","Spatial"’: no definition for class “Spatial”
in method for ‘coerce’ with signature ‘"sfc","Spatial"’: no definition for class “Spatial”
in method for ‘coerce’ with signature ‘"XY","Spatial"’: no definition for class “Spatial”
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error: package or namespace load failed for ‘sf’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/sf/libs/sf.so':
/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/sf/libs/sf.so: undefined symbol: GEOSFrechetDistanceDensify_r
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/sf’
Warning in install.packages :
installation of package ‘sf’ had non-zero exit status
ERROR: dependency ‘sf’ is not available for package ‘lwgeom’
* removing ‘/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/lwgeom’
Warning in install.packages :
installation of package ‘lwgeom’ had non-zero exit status
ERROR: dependency ‘sf’ is not available for package ‘mapview’
* removing ‘/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/mapview’
Warning in install.packages :
installation of package ‘mapview’ had non-zero exit status
ERROR: dependency ‘sf’ is not available for package ‘stars’
* removing ‘/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/stars’
Warning in install.packages :
installation of package ‘stars’ had non-zero exit status
ERROR: dependencies ‘sf’, ‘lwgeom’ are not available for package ‘tmaptools’
* removing ‘/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/tmaptools’
Warning in install.packages :
installation of package ‘tmaptools’ had non-zero exit status
ERROR: dependencies ‘tmaptools’, ‘sf’, ‘mapview’ are not available for package ‘tmap’
* removing ‘/home/rodrigo/R/x86_64-pc-linux-gnu-library/3.5/tmap’
Warning in install.packages :
installation of package ‘tmap’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmptKPuTu/downloaded_packages’
What I don't understand (apart from the errors that I can't solve) is: how can sf be a dependency for lwgeom, and lwgeom be a dependency for sf at the same time?
Well, I ended up uninstalling and installing again both GDAL and GEOS, from Debian official repositories and from source, a few times. Until I got it right, don't know exactly how or why. In the end I got up with this:
ldconfig -v | grep gdal
libgdal.so.20 -> libgdal.so.20.1.2
ldconfig -v | grep geos
libgeos-3.7.1.so -> libgeos.so
libgeos_c.so.1 -> libgeos_c.so.1.11.1
libgeos-3.5.1.so -> libgeos-3.5.1.so
libgeos_c.so.1 -> libgeos_c.so.1.9.1
Which is quite similar to the first problem I had (more than one version of GEOS). So don't ask me...
The installation of lwgeom and sf gave a few warnings, but I was finally able to install spider.
EDIT
I've ran into the same problem again (trying to install stplanr). This time, I found out that I have installed one of libgeos' versions from source. So I went to the directory of the source and issued sudo make uninstall, which removed it nicely. Then I just reinstalled the official version from Debian repository, and now I could install both lwgeom and sf in R.

Unable toInstalling xlsx package in Rstudio. rjava ,unable to load shared object in ubuntu 16.04

> install.packages("rJava")
Installing package into ‘/home/unix/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/rJava_0.9-10.tar.gz'
Content type 'application/x-gzip' length 672577 bytes (656 KB)
==================================================
downloaded 656 KB
* installing *source* package ‘rJava’ ...
** package ‘rJava’ successfully unpacked and MD5 sums checked
checking for gcc... gcc -std=gnu99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for string.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking whether time.h and sys/time.h may both be included... yes
configure: checking whether gcc -std=gnu99 supports static inline...
yes
checking whether setjmp.h is POSIX.1 compatible... yes
checking whether sigsetjmp is declared... yes
checking whether siglongjmp is declared... yes
checking Java support in R... present:
interpreter : '/usr/bin/java'
archiver : '/usr/bin/jar'
compiler : '/usr/bin/javac'
header prep.: '/usr/bin/javah'
cpp flags : '-I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux'
java libs : '-L/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server -ljvm'
checking whether Java run-time works... yes
checking whether -Xrs is supported... yes
checking whether -Xrs will be used... yes
checking whether JNI programs can be compiled... yes
checking JNI data types... ok
checking whether JRI should be compiled (autodetect)... yes
checking whether debugging output should be enabled... no
checking whether memory profiling is desired... no
checking whether threads support is requested... no
checking whether callbacks support is requested... no
checking whether JNI cache support is requested... no
checking whether headless init is enabled... no
checking whether JRI is requested... yes
configure: creating ./config.status
config.status: creating src/Makevars
config.status: creating R/zzz.R
config.status: creating src/config.h
=== configuring in jri (/tmp/RtmphqeUs3/R.INSTALL29e9145183b8/rJava/jri)
configure: running /bin/bash ./configure --disable-option-checking '--prefix=/usr/local' --cache-file=/dev/null --srcdir=.
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for gcc... gcc -std=gnu99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking Java version... 1.8.0_181
checking whether /usr/bin/javah actually works... yes
checking for target flags... -target 1.4 -source 1.4
checking whether Java interpreter works... checking whether JNI programs can be compiled... yes
checking whether JNI programs can be run... yes
checking JNI data types... ok
checking whether Rinterface.h exports R_CStackXXX variables... yes
checking whether Rinterface.h exports R_SignalHandlers... yes
configure: creating ./config.status
config.status: creating src/Makefile
config.status: creating Makefile
config.status: creating run
config.status: creating src/config.h
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c Rglue.c -o Rglue.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c arrayc.c -o arrayc.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c callJNI.c -o callJNI.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c callback.c -o callback.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c fields.c -o fields.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -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. -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c jri_glue.c -o jri_glue.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c loader.c -o loader.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c otables.c -o otables.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c rJava.c -o rJava.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c tools.c -o tools.o
g++ -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o rJava.so Rglue.o arrayc.o callJNI.o callback.o fields.o init.o jri_glue.o loader.o otables.o rJava.o tools.o -L/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server -ljvm -L/usr/lib/R/lib -lR
(cd ../jri && make)
make[1]: Entering directory '/tmp/RtmphqeUs3/R.INSTALL29e9145183b8/rJava/jri'
make -C src JRI.jar
make[2]: Entering directory '/tmp/RtmphqeUs3/R.INSTALL29e9145183b8/rJava/jri/src'
/usr/bin/javac -target 1.4 -source 1.4 -d . ../package-info.java ../REXP.java ../RFactor.java ../RList.java ../Mutex.java ../RConsoleOutputStream.java ../RMainLoopCallbacks.java ../RVector.java ../RBool.java ../Rengine.java
warning: [options] bootstrap class path not set in conjunction with -source 1.4
warning: [options] source value 1.4 is obsolete and will be removed in a future release
warning: [options] target value 1.4 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
4 warnings
if [ -n "/usr/bin/javah" ]; then /usr/bin/javah -d . -classpath . org.rosuda.JRI.Rengine; fi
gcc -std=gnu99 -c -o Rengine.o Rengine.c -g -Iinclude -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -fpic -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/usr/share/R/include -I/usr/share/R/include
gcc -std=gnu99 -c -o jri.o jri.c -g -Iinclude -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -fpic -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/usr/share/R/include -I/usr/share/R/include
gcc -std=gnu99 -c -o Rcallbacks.o Rcallbacks.c -g -Iinclude -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -fpic -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -I/usr/share/R/include -I/usr/share/R/include
gcc -std=gnu99 -c -o Rinit.o Rinit.c -g -Iinclude -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -fpic -I/usr/share/R/include -I/usr/share/R/include
gcc -std=gnu99 -c -o globals.o globals.c -g -Iinclude -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -fpic -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux
gcc -std=gnu99 -c -o rjava.o rjava.c -g -Iinclude -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux -fpic -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include -I/usr/lib/jvm/java-8-openjdk-amd64/jre/../include/linux
rjava.c: In function ‘RJava_request_lock’:
rjava.c:22:3: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
write(ipcout, buf, sizeof(ptrlong));
^
rjava.c: In function ‘RJava_clear_lock’:
rjava.c:30:3: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
write(ipcout, buf, sizeof(ptrlong));
^
rjava.c: In function ‘RJava_request_callback’:
rjava.c:39:3: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
write(ipcout, buf, sizeof(ptrlong) * 3);
^
rjava.c: In function ‘RJava_init_ctrl’:
rjava.c:51:3: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
write(ipcout, buf, sizeof(ptrlong));
^
rjava.c:52:3: warning: ignoring return value of ‘read’, declared with attribute warn_unused_result [-Wunused-result]
read(resin, buf, sizeof(ptrlong) * 2);
^
gcc -std=gnu99 -o libjri.so Rengine.o jri.o Rcallbacks.o Rinit.o globals.o rjava.o -shared -L/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server -ljvm -Wl,--export-dynamic -fopenmp -Wl,-Bsymbolic-functions -Wl,-z,relro -L/usr/lib/R/lib -lR -lpcre -llzma -lbz2 -lz -lrt -ldl -lm
/usr/bin/javac -target 1.4 -source 1.4 -d . ../package-info.java ../RFactor.java ../REXP.java ../RList.java ../Mutex.java ../RVector.java ../RBool.java ../RConsoleOutputStream.java ../Rengine.java ../RMainLoopCallbacks.java
warning: [options] bootstrap class path not set in conjunction with -source 1.4
warning: [options] source value 1.4 is obsolete and will be removed in a future release
warning: [options] target value 1.4 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
4 warnings
/usr/bin/jar fc JRI.jar org libjri.so
make[2]: Leaving directory '/tmp/RtmphqeUs3/R.INSTALL29e9145183b8/rJava/jri/src'
rm -f libjri.so
cp src/libjri.so libjri.so
/usr/bin/javac -target 1.4 -source 1.4 -classpath src/JRI.jar -d examples examples/rtest.java
warning: [options] bootstrap class path not set in conjunction with -source 1.4
warning: [options] source value 1.4 is obsolete and will be removed in a future release
warning: [options] target value 1.4 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
Note: examples/rtest.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
4 warnings
/usr/bin/javac -target 1.4 -source 1.4 -classpath src/JRI.jar -d examples examples/rtest2.java
warning: [options] bootstrap class path not set in conjunction with -source 1.4
warning: [options] source value 1.4 is obsolete and will be removed in a future release
warning: [options] target value 1.4 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
Note: examples/rtest2.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
4 warnings
make[1]: Leaving directory '/tmp/RtmphqeUs3/R.INSTALL29e9145183b8/rJava/jri'
installing via 'install.libs.R' to /home/unix/R/x86_64-pc-linux-gnu-library/3.4/rJava
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error: package or namespace load failed for ‘rJava’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/home/unix/R/x86_64-pc-linux-gnu-library/3.4/rJava/libs/rJava.so':
libjvm.so: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/unix/R/x86_64-pc-linux-gnu-library/3.4/rJava’
* restoring previous ‘/home/unix/R/x86_64-pc-linux-gnu-library/3.4/rJava’
Warning in install.packages :
installation of package ‘rJava’ had non-zero exit status
The downloaded source packages are in
‘/tmp/Rtmp1rqpcH/downloaded_packages’`enter code here`
**************************** loading the xlsx package ****************
library(xlsx)
Error: package or namespace load failed for ‘xlsx’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/home/unix/R/x86_64-pc-linux-gnu-library/3.4/rJava/libs/rJava.so':
libjvm.so: cannot open shared object file: No such file or directory
Getting rJava to work can be challenging. In your case I would suggest to use the c2d4u repository. Since you are using R 3.4, this would be:
sudo add-apt-repository ppa:marutter/c2d4u
sudo apt-get update
sudo apt-get install r-cran-xlsx
If you also update to R 3.5, you could use the corresponding repo:
sudo add-apt-repository ppa:marutter/c2d4u3.5
...

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/

Rgdal package install: projects.h: No such file or directory (error)

I'm trying to install Rgdal package on my local server (no connected to internet). when I ran install.packages("rgdal_1.2-15.tar.gz","/usr/lib64/R/library/",repos=NULL) I got an error inverser.c:4:22: error: projects.h: No such file or directory
this is the out put of install process:
* installing *source* package ‘rgdal’ ...
** package ‘rgdal’ successfully unpacked and MD5 sums checked
configure: CC: gcc -m64 -std=gnu99
configure: CXX: g++ -m64
configure: rgdal: 1.2-15
checking for /usr/bin/svnversion... no
configure: svn revision: 691
checking for gdal-config... /usr/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 1.8.1
checking GDAL version >= 1.6.3... yes
checking gdal: linking with --libs only... yes
checking GDAL: /usr/share/gdal/pcs.csv readable... yes
configure: -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fpic -fPIC -I/usr/include/gdal
checking proj_api.h presence and usability... yes
checking PROJ.4 version: ... 4.8.0
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: -lgdal -lproj
configure: creating ./config.status
config.status: creating src/Makevars
** libs
g++ -m64 -std=c++0x -I/usr/include/R -DNDEBUG -I/usr/include/gdal -I/usr/local/include -I"/usr/lib64/R/library/sp/include" -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c OGR_write.cpp -o OGR_write.o
g++ -m64 -std=c++0x -I/usr/include/R -DNDEBUG -I/usr/include/gdal -I/usr/local/include -I"/usr/lib64/R/library/sp/include" -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c gdal-bindings.cpp -o gdal-bindings.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/include/gdal -I/usr/local/include -I"/usr/lib64/R/library/sp/include" -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fpic -fPIC -c init.c -o init.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/include/gdal -I/usr/local/include -I"/usr/lib64/R/library/sp/include" -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fpic -fPIC -c inverser.c -o inverser.o
inverser.c:4:22: error: projects.h: No such file or directory
inverser.c:6: error: expected ‘)’ before ‘*’ token
make: *** [inverser.o] Error 1
ERROR: compilation failed for package ‘rgdal’
* removing ‘/usr/lib64/R/library/rgdal’
Warning message:
In install.packages("/data/ZUY10/Repo/R/rgdal_1.2-15.tar.gz", "/usr/lib64/R/library/", :
installation of package ‘/data/ZUY10/Repo/R/rgdal_1.2-15.tar.gz’ had non-zero exit status
What I did before this step:
Since my server is local, I had to install all package "dependencies" manually in my local server, So I installed like 30 packages manually which PROJ.4 and Gdal are principal as you can see here.
What do I miss here to install the RGDAL PACKAGE?
The header projects.h comes from PROJ.4. Where is that header file located on your system? You can pass this location to the configure script via --with-proj-include=DIR, i.e.
install.packages("rgdal_1.2-15.tar.gz",
"/usr/lib64/R/library/",
repos=NULL,
configure.args="--with-proj-include=DIR")
A check for projects.h being found has been added to rgdal only recently.
I have also faced above issue on RHEL7.7 upon doing multiple search. I resolved it as below:
#cd /opt
#wget http://download.osgeo.org/gdal/2.0.1/gdal-2.0.1.tar.gz
#./configure
#make
#make install
#echo "/usr/local/lib" >> /etc/ld.so.conf.d/libgdal-x86_64.conf
#ldconfig
#yum install proj.x86_64 proj-devel.x86_64 proj-epsg.x86_64 proj-nad.x86_64
Hope this helps.

Resources