r-spatial / sf

Simple Features for R
https://r-spatial.github.io/sf/
Other
1.34k stars 297 forks source link

Linking Warning for GEOS #2425

Closed fang19911030 closed 2 months ago

fang19911030 commented 2 months ago

Hi When I load package sf I get this warning:

> library(sf)
Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 7.0.0
WARNING: different compile-time and runtime versions for GEOS found:
Linked against: 3.8.0-CAPI-1.13.1  compiled against: 3.7.1-CAPI-1.11.1
It is probably a good idea to reinstall sf, and maybe rgeos and rgdal too

Does this have side effect on sf, I reinstalled the package several times, all tried some old version of sf. I still get this same warning. Any idea about the reason for this?

edzer commented 2 months ago

What is your sessionInfo()? Do you have multiple versions of GEOS installed on your system?

fang19911030 commented 2 months ago

Here is the output of sessionInfo():

> sessionInfo()
R version 4.2.2 (2022-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.6 LTS

Matrix products: default
BLAS:   /opt/R/4.2.2/lib/R/lib/libRblas.so
LAPACK: /opt/R/4.2.2/lib/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=C.UTF-8       LC_NUMERIC=C           LC_TIME=C.UTF-8       
 [4] LC_COLLATE=C.UTF-8     LC_MONETARY=C.UTF-8    LC_MESSAGES=C.UTF-8   
 [7] LC_PAPER=C.UTF-8       LC_NAME=C              LC_ADDRESS=C          
[10] LC_TELEPHONE=C         LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C   

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] sf_1.0-0

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.13        fansi_1.0.5        class_7.3-20       utf8_1.2.4        
 [5] dplyr_1.1.3        grid_4.2.2         R6_2.5.1           lifecycle_1.0.3   
 [9] DBI_1.2.3          magrittr_2.0.3     e1071_1.7-14       units_0.8-5       
[13] pillar_1.9.0       KernSmooth_2.23-20 rlang_1.1.1        cli_3.6.1         
[17] generics_0.1.3     vctrs_0.6.4        tools_4.2.2        glue_1.6.2        
[21] proxy_0.4-27       compiler_4.2.2     pkgconfig_2.0.3    classInt_0.4-10   
[25] tidyselect_1.2.0   tibble_3.2.1      

I don't think I have other version of GEOS on this machine. This is the output of find.

sudo find / -path /home -prune -o -name "*libgeos*" -print
/usr/share/doc/libgeos-3.8.0
/usr/share/doc/libgeos-c1v5
/usr/share/doc/libgeos-dev
/usr/share/lintian/overrides/libgeos-3.8.0
/usr/lib/x86_64-linux-gnu/libgeos_c.a
/usr/lib/x86_64-linux-gnu/libgeos_c.so.1.13.1
/usr/lib/x86_64-linux-gnu/libgeos_c.so
/usr/lib/x86_64-linux-gnu/libgeos-3.8.0.so
/usr/lib/x86_64-linux-gnu/libgeos_c.so.1
find: ‘/proc/2349/task/2349/net’: Invalid argument
find: ‘/proc/2349/net’: Invalid argument
/var/lib/dpkg/info/libgeos-c1v5:amd64.md5sums
/var/lib/dpkg/info/libgeos-c1v5:amd64.shlibs
/var/lib/dpkg/info/libgeos-c1v5:amd64.symbols
/var/lib/dpkg/info/libgeos-c1v5:amd64.triggers
/var/lib/dpkg/info/libgeos-3.8.0:amd64.list
/var/lib/dpkg/info/libgeos-c1v5:amd64.list
/var/lib/dpkg/info/libgeos-dev.md5sums
/var/lib/dpkg/info/libgeos-dev.list
/var/lib/dpkg/info/libgeos-3.8.0:amd64.md5sums
/var/lib/dpkg/info/libgeos-3.8.0:amd64.shlibs
/var/lib/dpkg/info/libgeos-3.8.0:amd64.symbols
/var/lib/dpkg/info/libgeos-3.8.0:amd64.triggers
edzer commented 2 months ago

Are you installing sf from source, or from a binary package repository?

fang19911030 commented 2 months ago

Current one is downloaded from https://cran.r-project.org/src/contrib/Archive/sf/

edzer commented 2 months ago

Please give the complete output you get from install.packages("sf")

fang19911030 commented 2 months ago

Thank you very much. Here is complete output @edzer

Installing package into ‘/home/pfang/R/x86_64-pc-linux-gnu-library/4.2’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/sf_1.0-16.tar.gz'
Content type 'application/x-gzip' length 3493756 bytes (3.3 MB)
==================================================
downloaded 3.3 MB

* installing *source* package ‘sf’ ...
** package ‘sf’ successfully unpacked and MD5 sums checked
** using staged installation
configure: CC: gcc
configure: CXX: g++ -std=gnu++14
checking for gdal-config... /usr/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 3.0.4
checking GDAL version >= 2.0.1... yes
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 gdal.h... yes
checking GDAL: linking with --libs only... yes
checking GDAL: /usr/share/gdal/pcs.csv readable... no
checking GDAL: checking whether PROJ is available for linking:... yes
checking GDAL: checking whether PROJ is available for running:... yes
configure: GDAL: 3.0.4
checking for proj.h... yes
checking PROJ: checking whether PROJ and sqlite3 are available for linking:... yes
checking for geos-config... /usr/bin/geos-config
checking geos-config usability... yes
configure: GEOS: 3.8.0
checking GEOS version >= 3.4.0... yes
checking for geos_c.h... yes
checking geos: linking with -L/usr/lib/x86_64-linux-gnu -lgeos_c... yes
configure: Package CPP flags:   -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include
configure: Package LIBS:  -L/usr/lib -lgdal -lproj  -L/usr/lib -lgdal -L/usr/lib/x86_64-linux-gnu -lgeos_c
configure: creating ./config.status
config.status: creating src/Makevars
** libs
g++ -std=gnu++14 -I"/opt/R/4.2.2/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/home/pfang/R/x86_64-pc-linux-gnu-library/4.2/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c RcppExports.cpp -o RcppExports.o
g++ -std=gnu++14 -I"/opt/R/4.2.2/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/home/pfang/R/x86_64-pc-linux-gnu-library/4.2/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c bbox.cpp -o bbox.o
g++ -std=gnu++14 -I"/opt/R/4.2.2/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/home/pfang/R/x86_64-pc-linux-gnu-library/4.2/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c gdal.cpp -o gdal.o
g++ -std=gnu++14 -I"/opt/R/4.2.2/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/home/pfang/R/x86_64-pc-linux-gnu-library/4.2/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c gdal_geom.cpp -o gdal_geom.o
g++ -std=gnu++14 -I"/opt/R/4.2.2/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/home/pfang/R/x86_64-pc-linux-gnu-library/4.2/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c gdal_read.cpp -o gdal_read.o
g++ -std=gnu++14 -I"/opt/R/4.2.2/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/home/pfang/R/x86_64-pc-linux-gnu-library/4.2/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c gdal_read_stream.cpp -o gdal_read_stream.o
g++ -std=gnu++14 -I"/opt/R/4.2.2/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/home/pfang/R/x86_64-pc-linux-gnu-library/4.2/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c gdal_utils.cpp -o gdal_utils.o
g++ -std=gnu++14 -I"/opt/R/4.2.2/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/home/pfang/R/x86_64-pc-linux-gnu-library/4.2/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c gdal_write.cpp -o gdal_write.o
g++ -std=gnu++14 -I"/opt/R/4.2.2/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/home/pfang/R/x86_64-pc-linux-gnu-library/4.2/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c geos.cpp -o geos.o
g++ -std=gnu++14 -I"/opt/R/4.2.2/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/home/pfang/R/x86_64-pc-linux-gnu-library/4.2/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c hex.cpp -o hex.o
g++ -std=gnu++14 -I"/opt/R/4.2.2/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/home/pfang/R/x86_64-pc-linux-gnu-library/4.2/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c mdim.cpp -o mdim.o
g++ -std=gnu++14 -I"/opt/R/4.2.2/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/home/pfang/R/x86_64-pc-linux-gnu-library/4.2/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c ops.cpp -o ops.o
g++ -std=gnu++14 -I"/opt/R/4.2.2/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/home/pfang/R/x86_64-pc-linux-gnu-library/4.2/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c polygonize.cpp -o polygonize.o
g++ -std=gnu++14 -I"/opt/R/4.2.2/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/home/pfang/R/x86_64-pc-linux-gnu-library/4.2/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c proj.cpp -o proj.o
g++ -std=gnu++14 -I"/opt/R/4.2.2/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/home/pfang/R/x86_64-pc-linux-gnu-library/4.2/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c proj_info.cpp -o proj_info.o
g++ -std=gnu++14 -I"/opt/R/4.2.2/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/home/pfang/R/x86_64-pc-linux-gnu-library/4.2/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c raster2sf.cpp -o raster2sf.o
g++ -std=gnu++14 -I"/opt/R/4.2.2/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/home/pfang/R/x86_64-pc-linux-gnu-library/4.2/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c sfc-sfg.cpp -o sfc-sfg.o
g++ -std=gnu++14 -I"/opt/R/4.2.2/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/home/pfang/R/x86_64-pc-linux-gnu-library/4.2/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c signed_area.cpp -o signed_area.o
g++ -std=gnu++14 -I"/opt/R/4.2.2/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/home/pfang/R/x86_64-pc-linux-gnu-library/4.2/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c stars.cpp -o stars.o
g++ -std=gnu++14 -I"/opt/R/4.2.2/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/home/pfang/R/x86_64-pc-linux-gnu-library/4.2/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c wkb.cpp -o wkb.o
g++ -std=gnu++14 -I"/opt/R/4.2.2/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/home/pfang/R/x86_64-pc-linux-gnu-library/4.2/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c zm_range.cpp -o zm_range.o
g++ -std=gnu++14 -shared -L/usr/local/lib -o sf.so RcppExports.o bbox.o gdal.o gdal_geom.o gdal_read.o gdal_read_stream.o gdal_utils.o gdal_write.o geos.o hex.o mdim.o ops.o polygonize.o proj.o proj_info.o raster2sf.o sfc-sfg.o signed_area.o stars.o wkb.o zm_range.o -L/usr/lib -lgdal -lproj -L/usr/lib -lgdal -L/usr/lib/x86_64-linux-gnu -lgeos_c
installing to /home/pfang/R/x86_64-pc-linux-gnu-library/4.2/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”
in method for ‘coerce’ with signature ‘"sgbp","sparseMatrix"’: no definition for class “sparseMatrix”
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** 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 (sf)
fang19911030 commented 2 months ago

My solve: I installed geos and gdal from ppa:ubuntugis/ubuntugis-unstable previously. I reinstalled geos and gdal from the default source. After installing sf again, the warning about different versions of geos disappeared.