Open HenrikBengtsson opened 1 week ago
my gdal version is 3.3.0 also has same question.
gdal.cpp: In function ‘Rcpp::NumericVector CPL_transform_bounds(Rcpp::NumericVector, Rcpp::List, int)’: gdal.cpp:713:16: error: ‘ret’ was not declared in this scope 713 | return ret; | ^~~ make: *** [/usr/lib64/R/etc/Makeconf:200: gdal.o] Error 1
@edzer is cycling to Prague: https://mastodon.social/@edzer/113114291930092331. I'll try to put up a PR. IIUC @HenrikBengtsson has GDAL 3.0.4, @weathermiya GDAL 3.3.0, so I need not go further back than 3.0.4; as you point out, the problem is obvious. In rgdal
days, we used belt and braces (both checking the external software version in R and compiled code), but here line 696 needs moving to before the conditional compile block.
3.0.4 is the version shipped in RHEL8, which is still widely in use, even though RHEL9 is out for a while already. I also encountered the issue there just now.
NB: There's usually no other OS being more behind than the "old stable" RHEL due to the long RHEL lifecycles, so keeping compatibility for those might solve the issue for all others, also for future occasions.
Rebuilding 3.3.0 on current Fedora 40 with g++ 14.2.1 fails with:
cpl_xml_validate.cpp: In function ‘void CPLLibXMLWarningErrorCallback(void*, const char*, ...)’:
cpl_xml_validate.cpp:923:48: error: invalid conversion from ‘const xmlError*’ {aka ‘const _xmlError*’} to ‘xmlErrorPtr’ {aka ‘_xmlError*’} [-fpermissive]
923 | xmlErrorPtr pErrorPtr = xmlGetLastError();
| ~~~~~~~~~~~~~~~^~
| |
| const xmlError* {aka const _xmlError*}
Which incantation of CXXFLAGS might persuade current g++ to behave as was expected in May 2021?
This is a source package tarball: sf_1.0-18.tar.gz, as yet not pushed to my fork. Could someone please check on a system with GDAL < 3.4.0?
This is a source package tarball: sf_1.0-18.tar.gz, as yet not pushed to my fork. Could someone please check on a system with GDAL < 3.4.0?
gdal3.3.0 install successfully thanks!
Work on RHEL8 with GDAL 3.0.4.
Over then to @edzer. Should I link to this draft source package on the R-sig-geo mailing list in case others are looking for a fix?
Following the merge, could someone with GDAL < 3.4.0 try remotes::install_github("r-spatial/sf")
?
worked for me with GDAL 3.0.4
on ubuntu focal 20.04, thank you for the quick fix!
> remotes::install_github(repo = "r-spatial/sf")
Downloading GitHub repo r-spatial/sf@HEAD
Running `R CMD build`...
* checking for file ‘/tmp/RtmpMNsu0s/remotes10c4f632fb6/r-spatial-sf-a07adc6/DESCRIPTION’ ... OK
* preparing ‘sf’:
* checking DESCRIPTION meta-information ... OK
* cleaning src
* running ‘cleanup’
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* building ‘sf_1.0-18.tar.gz’
Installing package into ‘/cloud/lib/x86_64-pc-linux-gnu-library/4.4’
(as ‘lib’ is unspecified)
* installing *source* package ‘sf’ ...
** using staged installation
configure: CC: gcc
configure: CXX: g++ -std=gnu++17
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
configure: pkg-config proj exists, will use it
configure: using proj.h.
configure: PROJ: 6.3.1
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: -lproj -L/usr/lib -lgdal -L/usr/lib/x86_64-linux-gnu -lgeos_c
configure: creating ./config.status
config.status: creating src/Makevars
** libs
using C++ compiler: ‘g++ (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0’
g++ -std=gnu++17 -I"/opt/R/4.4.1/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/cloud/lib/x86_64-pc-linux-gnu-library/4.4/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c RcppExports.cpp -o RcppExports.o
g++ -std=gnu++17 -I"/opt/R/4.4.1/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/cloud/lib/x86_64-pc-linux-gnu-library/4.4/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c bbox.cpp -o bbox.o
g++ -std=gnu++17 -I"/opt/R/4.4.1/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/cloud/lib/x86_64-pc-linux-gnu-library/4.4/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c gdal.cpp -o gdal.o
g++ -std=gnu++17 -I"/opt/R/4.4.1/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/cloud/lib/x86_64-pc-linux-gnu-library/4.4/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c gdal_geom.cpp -o gdal_geom.o
g++ -std=gnu++17 -I"/opt/R/4.4.1/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/cloud/lib/x86_64-pc-linux-gnu-library/4.4/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c gdal_read.cpp -o gdal_read.o
g++ -std=gnu++17 -I"/opt/R/4.4.1/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/cloud/lib/x86_64-pc-linux-gnu-library/4.4/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c gdal_read_stream.cpp -o gdal_read_stream.o
g++ -std=gnu++17 -I"/opt/R/4.4.1/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/cloud/lib/x86_64-pc-linux-gnu-library/4.4/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c gdal_utils.cpp -o gdal_utils.o
g++ -std=gnu++17 -I"/opt/R/4.4.1/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/cloud/lib/x86_64-pc-linux-gnu-library/4.4/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c gdal_write.cpp -o gdal_write.o
g++ -std=gnu++17 -I"/opt/R/4.4.1/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/cloud/lib/x86_64-pc-linux-gnu-library/4.4/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c geos.cpp -o geos.o
g++ -std=gnu++17 -I"/opt/R/4.4.1/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/cloud/lib/x86_64-pc-linux-gnu-library/4.4/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c hex.cpp -o hex.o
g++ -std=gnu++17 -I"/opt/R/4.4.1/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/cloud/lib/x86_64-pc-linux-gnu-library/4.4/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c mdim.cpp -o mdim.o
g++ -std=gnu++17 -I"/opt/R/4.4.1/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/cloud/lib/x86_64-pc-linux-gnu-library/4.4/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c ops.cpp -o ops.o
g++ -std=gnu++17 -I"/opt/R/4.4.1/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/cloud/lib/x86_64-pc-linux-gnu-library/4.4/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c polygonize.cpp -o polygonize.o
g++ -std=gnu++17 -I"/opt/R/4.4.1/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/cloud/lib/x86_64-pc-linux-gnu-library/4.4/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c proj.cpp -o proj.o
g++ -std=gnu++17 -I"/opt/R/4.4.1/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/cloud/lib/x86_64-pc-linux-gnu-library/4.4/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c proj_info.cpp -o proj_info.o
g++ -std=gnu++17 -I"/opt/R/4.4.1/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/cloud/lib/x86_64-pc-linux-gnu-library/4.4/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c raster2sf.cpp -o raster2sf.o
g++ -std=gnu++17 -I"/opt/R/4.4.1/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/cloud/lib/x86_64-pc-linux-gnu-library/4.4/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c sfc-sfg.cpp -o sfc-sfg.o
g++ -std=gnu++17 -I"/opt/R/4.4.1/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/cloud/lib/x86_64-pc-linux-gnu-library/4.4/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c signed_area.cpp -o signed_area.o
g++ -std=gnu++17 -I"/opt/R/4.4.1/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/cloud/lib/x86_64-pc-linux-gnu-library/4.4/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c stars.cpp -o stars.o
g++ -std=gnu++17 -I"/opt/R/4.4.1/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/cloud/lib/x86_64-pc-linux-gnu-library/4.4/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c wkb.cpp -o wkb.o
g++ -std=gnu++17 -I"/opt/R/4.4.1/lib/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/cloud/lib/x86_64-pc-linux-gnu-library/4.4/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c zm_range.cpp -o zm_range.o
g++ -std=gnu++17 -shared -L/opt/R/4.4.1/lib/R/lib -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 -lproj -L/usr/lib -lgdal -L/usr/lib/x86_64-linux-gnu -lgeos_c -L/opt/R/4.4.1/lib/R/lib -lR
installing to /cloud/lib/x86_64-pc-linux-gnu-library/4.4/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)
Following the merge, could someone with GDAL < 3.4.0 try
remotes::install_github("r-spatial/sf")
?remotes::install_github("r-spatial/sf") Downloading GitHub repo r-spatial/sf@HEAD ── R CMD build ────────────────────────────────────────────────────────────────────────────────────────────────────────── ✔ checking for file ‘/tmp/RtmplznSaA/remotesd7422586a3d25/r-spatial-sf-a07adc6/DESCRIPTION’ (341ms) ─ preparing ‘sf’: ✔ checking DESCRIPTION meta-information ─ cleaning src ─ checking for LF line-endings in source and make files and shell scripts ─ checking for empty or unneeded directories ─ building ‘sf_1.0-18.tar.gz’ Warning: invalid uid value replaced by that for user 'nobody' Warning: invalid gid value replaced by that for user 'nobody'
Installing package into ‘/home/fa079944/R/x86_64-pc-linux-gnu-library/4.2’ (as ‘lib’ is unspecified)
dir.create(paste0("/home/", Sys.getenv("LOGNAME"), "/tmp/")) Warning message: In dir.create(paste0("/home/", Sys.getenv("LOGNAME"), "/tmp/")) : '/home/fa079944/tmp' already exists Sys.setenv(TMPDIR = paste0("/home/", Sys.getenv("LOGNAME"), "/tmp/")) remotes::install_github("r-spatial/sf") Downloading GitHub repo r-spatial/sf@HEAD ── R CMD build ────────────────────────────────────────────────────────────────────────────────────────────────────────── ✔ checking for file ‘/tmp/RtmplznSaA/remotesd742249633317/r-spatial-sf-a07adc6/DESCRIPTION’ ... ─ preparing ‘sf’: ✔ checking DESCRIPTION meta-information ... ─ cleaning src ─ running ‘cleanup’ ─ checking for LF line-endings in source and make files and shell scripts ─ checking for empty or unneeded directories ─ building ‘sf_1.0-18.tar.gz’ Warning: file 'sf/cleanup' did not have execute permissions: corrected Warning: file 'sf/configure' did not have execute permissions: corrected Warning: invalid uid value replaced by that for user 'nobody' Warning: invalid gid value replaced by that for user 'nobody'
Installing package into ‘/home/fa079944/R/x86_64-pc-linux-gnu-library/4.2’ (as ‘lib’ is unspecified)
Issue
This is because
ret
in:https://github.com/r-spatial/sf/blob/061196ef88b9406a2cc429c10f459c47e98b86aa/src/gdal.cpp#L713
is never refined for
GDAL_VERSION_NUM < 3040000
.