Skip to content

sf 1.0-6 requires GDAL (>= 3.0.0)? [SOLVED for sf 1.0-7] #1899

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
HenrikBengtsson opened this issue Feb 5, 2022 · 17 comments
Closed

sf 1.0-6 requires GDAL (>= 3.0.0)? [SOLVED for sf 1.0-7] #1899

HenrikBengtsson opened this issue Feb 5, 2022 · 17 comments

Comments

@HenrikBengtsson
Copy link

HenrikBengtsson commented Feb 5, 2022

WORKAROUND:

Until sf (>= 1.0-7) is on CRAN, you can install the develop version, which also has version 1.0-7, using:

remotes::install_github("r-spatial/sf")

Consider this an FYI for now, as I guess you get more reports on this soon:

In contrast to sf 1.0-5 (2021-12-17), I think the new sf 1.0-6 (2022-02-04) requires something newer than GDAL (>= 2.0.1) that the DESCRIPTION file mentions.

Because, when I install with GDAL 2.4.4, on R 4.1.2, I get an error on:

stars.cpp:771:7: error: ‘class OGRSpatialReference’ has no member named ‘SetAxisMappingStrategy’
  oSRS.SetAxisMappingStrategy(OAMS_TRADITIONAL_GIS_ORDER);
       ^~~~~~~~~~~~~~~~~~~~~~
stars.cpp:771:30: error: ‘OAMS_TRADITIONAL_GIS_ORDER’ was not declared in this scope
  oSRS.SetAxisMappingStrategy(OAMS_TRADITIONAL_GIS_ORDER);
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~

This is on CentOS 7. I get the same error on Ubuntu 18.04, which has GDAL 2.2.3 (Ubuntu package gdal-bin 2.2.3+dfsg-2). sf 1.0-5 installs fine on both of these systems (see below).

I'll see if I can install the next version up from GDAL 2.4.4, i.e. GDAL 3.0.0, and retry with that.

Details for CentOS run

Setup

$ gdalinfo --version
GDAL 2.4.4, released 2020/01/08

$ geos-config --version
3.4.2

$ proj 2>&1 | head -1
Rel. 4.8.0, 6 March 2012

$ g++ --version | head -1
g++ (GCC) 8.3.1 20190311 (Red Hat 8.3.1-3)

$ R --version | head -1
R version 4.1.2 (2021-11-01) -- "Bird Hippie"

sf 1.0.6 (fails to install)

Click to see install log
> install.packages("sf")
Installing package into ‘/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/sf_1.0-6.tar.gz'
Content type 'application/x-gzip' length 3528078 bytes (3.4 MB)
==================================================
downloaded 3.4 MB
  • installing source package ‘sf’ ...
    ** package ‘sf’ successfully unpacked and MD5 sums checked
    ** using staged installation
    configure: CC: gcc
    configure: CXX: g++ -std=gnu++11
    checking for gdal-config... /wynton/home/cbi/shared/software/CBI/gdal-2.4.4/bin/gdal-config
    checking gdal-config usability... yes
    configure: GDAL: 2.4.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 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/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: /wynton/home/cbi/shared/software/CBI/gdal-2.4.4/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.4.4
    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.8.0
    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/lib64 -lgeos_c... yes
    configure: Package CPP flags: -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include
    configure: Package LIBS: -lproj -L/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/lib -lgdal -L/usr/lib64 -lgeos_c
    configure: creating ./config.status
    config.status: creating src/Makevars
    ** libs
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c RcppExports.cpp -o RcppExports.o
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c bbox.cpp -o bbox.o
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c gdal.cpp -o gdal.o
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c gdal_geom.cpp -o gdal_geom.o
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c gdal_read.cpp -o gdal_read.o
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c gdal_utils.cpp -o gdal_utils.o
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c gdal_write.cpp -o gdal_write.o
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c geos.cpp -o geos.o
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c hex.cpp -o hex.o
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c mdim.cpp -o mdim.o
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c ops.cpp -o ops.o
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c polygonize.cpp -o polygonize.o
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c proj.cpp -o proj.o
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c proj_info.cpp -o proj_info.o
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c raster2sf.cpp -o raster2sf.o
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c sfg.cpp -o sfg.o
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c signed_area.cpp -o signed_area.o
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c stars.cpp -o stars.o
    stars.cpp: In function ‘void CPL_create(Rcpp::CharacterVector, Rcpp::IntegerVector, Rcpp::NumericVector, Rcpp::CharacterVector, Rcpp::NumericVector, Rcpp::NumericVector)’:
    stars.cpp:771:7: error: ‘class OGRSpatialReference’ has no member named ‘SetAxisMappingStrategy’
    oSRS.SetAxisMappingStrategy(OAMS_TRADITIONAL_GIS_ORDER);
    ^~~~~~~~~~~~~~~~~~~~~~
    stars.cpp:771:30: error: ‘OAMS_TRADITIONAL_GIS_ORDER’ was not declared in this scope
    oSRS.SetAxisMappingStrategy(OAMS_TRADITIONAL_GIS_ORDER);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~
    make: *** [/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/etc/Makeconf:177: stars.o] Error 1
    ERROR: compilation failed for package ‘sf’
  • removing ‘/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/sf’
  • restoring previous ‘/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/sf’

The downloaded source packages are in
‘/tmp/Rtmpax2Spi/downloaded_packages’
Warning message:
In install.packages("sf") :
installation of package ‘sf’ had non-zero exit status

sf 1.0.5 (install fine)

Click to see install log
> install.packages("https://cran.r-project.org/src/contrib/Archive/sf/sf_1.0-5.tar.gz")
Installing package into ‘/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8’
(as ‘lib’ is unspecified)
inferring 'repos = NULL' from 'pkgs'
trying URL 'https://cran.r-project.org/src/contrib/Archive/sf/sf_1.0-5.tar.gz'
Content type 'application/x-gzip' length 3527059 bytes (3.4 MB)
==================================================
downloaded 3.4 MB
  • installing source package ‘sf’ ...
    ** package ‘sf’ successfully unpacked and MD5 sums checked
    ** using staged installation
    configure: CC: gcc
    configure: CXX: g++ -std=gnu++11
    checking for gdal-config... /wynton/home/cbi/shared/software/CBI/gdal-2.4.4/bin/gdal-config
    checking gdal-config usability... yes
    configure: GDAL: 2.4.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 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/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: /wynton/home/cbi/shared/software/CBI/gdal-2.4.4/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.4.4
    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.8.0
    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/lib64 -lgeos_c... yes
    configure: Package CPP flags: -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include
    configure: Package LIBS: -lproj -L/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/lib -lgdal -L/usr/lib64 -lgeos_c
    configure: creating ./config.status
    config.status: creating src/Makevars
    ** libs
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c RcppExports.cpp -o RcppExports.o
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c bbox.cpp -o bbox.o
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c gdal.cpp -o gdal.o
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c gdal_geom.cpp -o gdal_geom.o
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c gdal_read.cpp -o gdal_read.o
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c gdal_utils.cpp -o gdal_utils.o
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c gdal_write.cpp -o gdal_write.o
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c geos.cpp -o geos.o
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c hex.cpp -o hex.o
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c mdim.cpp -o mdim.o
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c ops.cpp -o ops.o
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c polygonize.cpp -o polygonize.o
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c proj.cpp -o proj.o
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c proj_info.cpp -o proj_info.o
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c raster2sf.cpp -o raster2sf.o
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c sfg.cpp -o sfg.o
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c signed_area.cpp -o signed_area.o
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c stars.cpp -o stars.o
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c wkb.cpp -o wkb.o
    g++ -std=gnu++11 -I"/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/include -I/usr/include -I'/wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c zm_range.cpp -o zm_range.o
    g++ -std=gnu++11 -shared -L/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/lib -L/usr/local/lib64 -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 mdim.o ops.o polygonize.o proj.o proj_info.o raster2sf.o sfg.o signed_area.o stars.o wkb.o zm_range.o -lproj -L/wynton/home/cbi/shared/software/CBI/gdal-2.4.4/lib -lgdal -L/usr/lib64 -lgeos_c -L/wynton/home/cbi/shared/software/CBI/R-4.1.2-gcc8/lib64/R/lib -lR
    installing to /wynton/home/bengtsson/hb-test/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/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)
@HenrikBengtsson
Copy link
Author

HenrikBengtsson commented Feb 5, 2022

Okay, I've install GDAL 3.0.0, which is the next version after GDAL 2.4.0. GDAL 3.0.0 requires PROJ 6.0.0, so I installed that too. I'm getting closer, but now I get:

proj.cpp:279:14: error: ‘proj_normalize_for_visualization’ was not declared in this scope
   PJ *NewP = proj_normalize_for_visualization(PJ_DEFAULT_CTX, P);
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [/software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/etc/Makeconf:177: proj.o] Error 1

This looks like an issue related to PROJ.

Details

$ gdalinfo --version
GDAL 3.0.0, released 2019/05/05

$ geos-config --version
3.4.2

$ proj 2>&1 | head -1
Rel. 6.0.0, March 1st, 2019

$ g++ --version | head -1
g++ (GCC) 8.3.1 20190311 (Red Hat 8.3.1-3)

$ R --version | head -1
R version 4.1.2 (2021-11-01) -- "Bird Hippie"
> install.packages("sf")
Installing package into/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8’
(aslibis unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/sf_1.0-6.tar.gz'
Content type 'application/x-gzip' length 3528078 bytes (3.4 MB)
==================================================
downloaded 3.4 MB

* installing *source* packagesf...
** packagesfsuccessfully unpacked and MD5 sums checked
** using staged installation
configure: CC: gcc
configure: CXX: g++ -std=gnu++11
checking for gdal-config... /software/c4/cbi/software/gdal-3.0.0/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 3.0.0
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 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/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: /software/c4/cbi/software/gdal-3.0.0/share/gdal/pcs.csv readable... no
checking GDAL: checking whether PROJ is available for linking:... yes
checking GDAL: checking whether PROJ is available fur running:... yes
configure: GDAL: 3.0.0
configure: pkg-config proj exists, will use it
configure: using proj.h.
configure: PROJ: 6.0.0
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.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/lib64 -lgeos_c... yes
configure: Package CPP flags:  -I/software/c4/cbi/software/proj-6.0.0/include   -DHAVE_PROJ_H -I/software/c4/cbi/software/gdal-3.0.0/include -I/usr/include
configure: Package LIBS: -L/software/c4/cbi/software/proj-6.0.0/lib -lproj     -L/software/c4/cbi/software/gdal-3.0.0/lib -lgdal -L/usr/lib64 -lgeos_c
configure: creating ./config.status
config.status: creating src/Makevars
** libs
g++ -std=gnu++11 -I"/software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/software/c4/cbi/software/proj-6.0.0/include   -DHAVE_PROJ_H -I/software/c4/cbi/software/gdal-3.0.0/include -I/usr/include -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c RcppExports.cpp -o RcppExports.o
g++ -std=gnu++11 -I"/software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/software/c4/cbi/software/proj-6.0.0/include   -DHAVE_PROJ_H -I/software/c4/cbi/software/gdal-3.0.0/include -I/usr/include -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c bbox.cpp -o bbox.o
g++ -std=gnu++11 -I"/software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/software/c4/cbi/software/proj-6.0.0/include   -DHAVE_PROJ_H -I/software/c4/cbi/software/gdal-3.0.0/include -I/usr/include -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c gdal.cpp -o gdal.o
g++ -std=gnu++11 -I"/software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/software/c4/cbi/software/proj-6.0.0/include   -DHAVE_PROJ_H -I/software/c4/cbi/software/gdal-3.0.0/include -I/usr/include -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c gdal_geom.cpp -o gdal_geom.o
g++ -std=gnu++11 -I"/software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/software/c4/cbi/software/proj-6.0.0/include   -DHAVE_PROJ_H -I/software/c4/cbi/software/gdal-3.0.0/include -I/usr/include -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c gdal_read.cpp -o gdal_read.o
g++ -std=gnu++11 -I"/software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/software/c4/cbi/software/proj-6.0.0/include   -DHAVE_PROJ_H -I/software/c4/cbi/software/gdal-3.0.0/include -I/usr/include -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c gdal_utils.cpp -o gdal_utils.o
g++ -std=gnu++11 -I"/software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/software/c4/cbi/software/proj-6.0.0/include   -DHAVE_PROJ_H -I/software/c4/cbi/software/gdal-3.0.0/include -I/usr/include -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c gdal_write.cpp -o gdal_write.o
g++ -std=gnu++11 -I"/software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/software/c4/cbi/software/proj-6.0.0/include   -DHAVE_PROJ_H -I/software/c4/cbi/software/gdal-3.0.0/include -I/usr/include -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c geos.cpp -o geos.o
g++ -std=gnu++11 -I"/software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/software/c4/cbi/software/proj-6.0.0/include   -DHAVE_PROJ_H -I/software/c4/cbi/software/gdal-3.0.0/include -I/usr/include -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c hex.cpp -o hex.o
g++ -std=gnu++11 -I"/software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/software/c4/cbi/software/proj-6.0.0/include   -DHAVE_PROJ_H -I/software/c4/cbi/software/gdal-3.0.0/include -I/usr/include -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c mdim.cpp -o mdim.o
g++ -std=gnu++11 -I"/software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/software/c4/cbi/software/proj-6.0.0/include   -DHAVE_PROJ_H -I/software/c4/cbi/software/gdal-3.0.0/include -I/usr/include -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c ops.cpp -o ops.o
g++ -std=gnu++11 -I"/software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/software/c4/cbi/software/proj-6.0.0/include   -DHAVE_PROJ_H -I/software/c4/cbi/software/gdal-3.0.0/include -I/usr/include -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c polygonize.cpp -o polygonize.o
g++ -std=gnu++11 -I"/software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/software/c4/cbi/software/proj-6.0.0/include   -DHAVE_PROJ_H -I/software/c4/cbi/software/gdal-3.0.0/include -I/usr/include -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c proj.cpp -o proj.o
proj.cpp: In functionRcpp::NumericMatrix CPL_proj_direct(Rcpp::CharacterVector, Rcpp::NumericMatrix, bool, bool, bool)’:
proj.cpp:279:14: error:proj_normalize_for_visualizationwas not declared in this scope
   PJ *NewP = proj_normalize_for_visualization(PJ_DEFAULT_CTX, P);
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [/software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/etc/Makeconf:177: proj.o] Error 1
ERROR: compilation failed for packagesf* removing/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/sf* restoring previous/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/sfThe downloaded source packages are in/scratch/henrik/RtmpSfwGlQ/downloaded_packagesWarning message:
In install.packages("sf") :
  installation of packagesfhad non-zero exit status

@edzer
Copy link
Member

edzer commented Feb 5, 2022

Thanks! The errors you see concerns code that hasn't been touched in a long time; you don't happen to have more than one version of GDAL/PROJ/GEOS installed, do you?

@anirban-mukherjee
Copy link

I am getting the same error on a stock debian buster image (Google cloud image). I don't think this machine has multiple versions installed. It should be clean (I did install a few things). I did not get this error when installing on the same image family (the prior version of the image, it has been updated since) about a few days ago. I don't know what has been updated since but there is some chance that something has been automatically updated.

Any ideas on how best to proceed? Below is exactly what I get:

stars.cpp: In function 'void CPL_create(Rcpp::CharacterVector, Rcpp::IntegerVector, Rcpp::NumericVector, Rcpp::CharacterVector, Rcpp::NumericVector, Rcpp::NumericVector)':
stars.cpp:771:7: error: 'class OGRSpatialReference' has no member named 'SetAxisMappingStrategy'
  oSRS.SetAxisMappingStrategy(OAMS_TRADITIONAL_GIS_ORDER);
       ^~~~~~~~~~~~~~~~~~~~~~
stars.cpp:771:30: error: 'OAMS_TRADITIONAL_GIS_ORDER' was not declared in this scope
  oSRS.SetAxisMappingStrategy(OAMS_TRADITIONAL_GIS_ORDER);
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [/usr/lib/R/etc/Makeconf:177: stars.o] Error 1
ERROR: compilation failed for package 'sf'
* removing '/usr/local/lib/R/site-library/sf'
$ gdalinfo --version
GDAL 2.4.0, released 2018/12/14
$ geos-config --version
3.7.1
$ proj 2>&1 | head -1
Rel. 5.2.0, September 15th, 2018
$ g++ --version | head -1
g++ (Debian 8.3.0-6) 8.3.0
$ R --version | head -1
R version 4.1.2 (2021-11-01) -- "Bird Hippie"

@anirban-mukherjee
Copy link

I can confirm that sf 1.0-5 installs as expected. I did not change any libraries or update anything else on. I used dev tools to install: install_version("sf", version = "1.0-5", repos = "http://cran.us.r-project.org")

@rsbivand
Copy link
Member

rsbivand commented Feb 5, 2022

With hand-installed GDAL: 2.2.4, PROJ: 5.2.0, GEOS: 3.7.3 and sf main HEAD:

g++ -std=gnu++11 -I"/home/rsb/topics/R/R412-share/lib64/R/include" -DNDEBUG -I/usr/local/include  -I/usr/local/include -I/usr/local/include -I'/home/rsb/lib/r_libs/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c stars.cpp -o stars.o
stars.cpp: In function ‘void CPL_create(Rcpp::CharacterVector, Rcpp::IntegerVector, Rcpp::NumericVector, Rcpp::CharacterVector, Rcpp::NumericVector, Rcpp::NumericVector)’:
stars.cpp:771:14: error: ‘class OGRSpatialReference’ has no member named ‘SetAxisMappingStrategy’
  771 |         oSRS.SetAxisMappingStrategy(OAMS_TRADITIONAL_GIS_ORDER);
      |              ^~~~~~~~~~~~~~~~~~~~~~
stars.cpp:771:37: error: ‘OAMS_TRADITIONAL_GIS_ORDER’ was not declared in this scope
  771 |         oSRS.SetAxisMappingStrategy(OAMS_TRADITIONAL_GIS_ORDER);
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [/home/rsb/topics/R/R412-share/lib64/R/etc/Makeconf:177: stars.o] Error 1
ERROR: compilation failed for package 'sf'
* removing '/tmp/Rtmpz5a2dN/Rinstc2301fbabdd1/sf'
      -----------------------------------
ERROR: package installation failed

Indeed, OAMS_TRADITIONAL_GIS_ORDER does not seem to be in the GDAL source until 3.0, see the MIGRATION GUIDE:

OSRImportFromEPSG() takes into account official axis order.
Traditional GIS-friendly axis order can be restored with
OGRSpatialReference::SetAxisMappingStrategy(OAMS_TRADITIONAL_GIS_ORDER);

sf_1.0-5 installs cleanly on PROJ 5.2.0 with GDAL 2.2.4, but R CMD check doesn't complete cleanly as terra needed by tmap does not install:

g++ -std=gnu++11 -I"/home/rsb/topics/R/R412-share/lib64/R/include" -DNDEBUG -I/usr/local/include  -I/usr/local/include -I/usr/local/include -I'/home/rsb/lib/r_libs/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c write_ogr.cpp -o write_ogr.o
write_ogr.cpp: In member function ‘GDALDataset* SpatVector::write_ogr(std::string, std::string, std::string, bool, bool, std::vector<std::__cxx11::basic_string<char> >)’:
write_ogr.cpp:126:55: error: ‘invalid_argument’ in namespace ‘std’ does not name a type
  126 |                                         } catch (std::invalid_argument &e)  {
      |                                                       ^~~~~~~~~~~~~~~~
make: *** [/home/rsb/topics/R/R412-share/lib64/R/etc/Makeconf:177: write_ogr.o] Error 1
ERROR: compilation failed for package 'terra'

@rsbivand
Copy link
Member

rsbivand commented Feb 5, 2022

@edzer, line 754 in stars.cpp: oSRS.SetAxisMappingStrategy(OAMS_TRADITIONAL_GIS_ORDER);
in add gdal_create() for stars: a6faeb9#diff-37479bf864ddebb7cd25ec6420d4e7bf3eafbfe2629dc18c9789fa5aa0668c81

looks unprotected.

@rsbivand
Copy link
Member

rsbivand commented Feb 5, 2022

A quick fix is to protect that line by:

#if defined(HAVE_PROJ_H) && !defined(ACCEPT_USE_OF_DEPRECATED_PROJ_API_H)
	oSRS.SetAxisMappingStrategy(OAMS_TRADITIONAL_GIS_ORDER);
#endif

but maybe the GDAL version can be queried instead?

@edzer
Copy link
Member

edzer commented Feb 5, 2022

Thanks, I used

#if GDAL_VERSION_NUM >= 2050000

similar to https://github.com/r-spatial/sf/blob/main/src/gdal.cpp#L676-L683

This is indeed code that was introduced after sf 1.0-5 was released, in a6faeb9#diff-37479bf864ddebb7cd25ec6420d4e7bf3eafbfe2629dc18c9789fa5aa0668c81 , and not properly tested against older GDAL versions.

edzer added a commit that referenced this issue Feb 5, 2022
@edzer
Copy link
Member

edzer commented Feb 5, 2022

This should fix it; would be great if one of you @HenrikBengtsson or @anirban-mukherjee could confirm.

@rsbivand
Copy link
Member

rsbivand commented Feb 5, 2022

Yes, I can confirm that for my platform the fix removes the problem, but am running hand-installed legacy PROJ+GDAL, so confirmation from the actual cases with binary PROJ+GDAL installs would be very helpful.

@anirban-mukherjee
Copy link

Thanks for the super quick fix folks. Confirming that devtools::install_github("r-spatial/sf") compiles and installs as expected on Debian Buster.

@HenrikBengtsson
Copy link
Author

Thanks for the quick fix. Confirming it works again on the above CentOS 7.9 and Ubuntu 18.04 setups;

CentOS 7.9:

$ geos-config --version
3.4.2
$ command -v geos-config
/usr/bin/geos-config

$ proj 2>&1 | head -1
Rel. 4.8.0, 6 March 2012
$ command -v proj
/usr/bin/proj

$ gdal-config --version
2.4.4
$ command -v gdal-config
/software/c4/cbi/software/gdal-2.4.4/bin/gdal-config

$ g++ --version | head -1
g++ (GCC) 8.3.1 20190311 (Red Hat 8.3.1-3)
$ command -v gcc
/opt/rh/devtoolset-8/root/usr/bin/gcc

Ubuntu 18.04:

$ geos-config --version
3.6.2
$ command -v geos-config
/usr/bin/geos-config

$ proj 2>&1 | head -1
Rel. 4.9.3, 15 August 2016
$ command -v proj
/usr/bin/proj

$ gdal-config --version
2.2.3
$ command -v gdal-config
/usr/bin/gdal-config

$ g++ --version | head -1
g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
$ command -v g++
/usr/bin/g++```

For the records, just so others troubleshooting have something to compare to, here's what it now looks like on the CentOS 7.9 setup:

$ R
R version 4.1.2 (2021-11-01) -- "Bird Hippie"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
...
> remotes::install_github("r-spatial/sf")
Downloading GitHub repo r-spatial/sf@HEAD
Running `R CMD build`...
* checking for file ‘/scratch/henrik/Rtmp22lau6/remotes550f39c8ef64/r-spatial-sf-df6600c/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-7.tar.gz’
Installing package into ‘/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8’
(as ‘lib’ is unspecified)
* installing *source* package ‘sf’ ...
** using staged installation
configure: CC: gcc
configure: CXX: g++ -std=gnu++11
checking for gdal-config... /software/c4/cbi/software/gdal-2.4.4/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 2.4.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 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/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 for gdal.h... yes
checking GDAL: linking with --libs only... yes
checking GDAL: /software/c4/cbi/software/gdal-2.4.4/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.4.4
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.8.0
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/lib64 -lgeos_c... yes
configure: Package CPP flags:    -I/software/c4/cbi/software/gdal-2.4.4/include -I/usr/include
configure: Package LIBS: -lproj     -L/software/c4/cbi/software/gdal-2.4.4/lib -lgdal -L/usr/lib64 -lgeos_c
configure: creating ./config.status
config.status: creating src/Makevars
** libs
g++ -std=gnu++11 -I"/software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/software/c4/cbi/software/gdal-2.4.4/include -I/usr/include -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c RcppExports.cpp -o RcppExports.o
g++ -std=gnu++11 -I"/software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/software/c4/cbi/software/gdal-2.4.4/include -I/usr/include -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c bbox.cpp -o bbox.o
g++ -std=gnu++11 -I"/software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/software/c4/cbi/software/gdal-2.4.4/include -I/usr/include -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c gdal.cpp -o gdal.o
g++ -std=gnu++11 -I"/software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/software/c4/cbi/software/gdal-2.4.4/include -I/usr/include -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c gdal_geom.cpp -o gdal_geom.o
g++ -std=gnu++11 -I"/software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/software/c4/cbi/software/gdal-2.4.4/include -I/usr/include -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c gdal_read.cpp -o gdal_read.o
g++ -std=gnu++11 -I"/software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/software/c4/cbi/software/gdal-2.4.4/include -I/usr/include -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c gdal_utils.cpp -o gdal_utils.o
g++ -std=gnu++11 -I"/software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/software/c4/cbi/software/gdal-2.4.4/include -I/usr/include -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c gdal_write.cpp -o gdal_write.o
g++ -std=gnu++11 -I"/software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/software/c4/cbi/software/gdal-2.4.4/include -I/usr/include -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c geos.cpp -o geos.o
g++ -std=gnu++11 -I"/software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/software/c4/cbi/software/gdal-2.4.4/include -I/usr/include -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c hex.cpp -o hex.o
g++ -std=gnu++11 -I"/software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/software/c4/cbi/software/gdal-2.4.4/include -I/usr/include -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c mdim.cpp -o mdim.o
g++ -std=gnu++11 -I"/software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/software/c4/cbi/software/gdal-2.4.4/include -I/usr/include -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c ops.cpp -o ops.o
g++ -std=gnu++11 -I"/software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/software/c4/cbi/software/gdal-2.4.4/include -I/usr/include -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c polygonize.cpp -o polygonize.o
g++ -std=gnu++11 -I"/software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/software/c4/cbi/software/gdal-2.4.4/include -I/usr/include -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c proj.cpp -o proj.o
g++ -std=gnu++11 -I"/software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/software/c4/cbi/software/gdal-2.4.4/include -I/usr/include -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c proj_info.cpp -o proj_info.o
g++ -std=gnu++11 -I"/software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/software/c4/cbi/software/gdal-2.4.4/include -I/usr/include -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c raster2sf.cpp -o raster2sf.o
g++ -std=gnu++11 -I"/software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/software/c4/cbi/software/gdal-2.4.4/include -I/usr/include -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c sfg.cpp -o sfg.o
g++ -std=gnu++11 -I"/software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/software/c4/cbi/software/gdal-2.4.4/include -I/usr/include -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c signed_area.cpp -o signed_area.o
g++ -std=gnu++11 -I"/software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/software/c4/cbi/software/gdal-2.4.4/include -I/usr/include -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c stars.cpp -o stars.o
g++ -std=gnu++11 -I"/software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/software/c4/cbi/software/gdal-2.4.4/include -I/usr/include -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c wkb.cpp -o wkb.o
g++ -std=gnu++11 -I"/software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/include" -DNDEBUG -I/software/c4/cbi/software/gdal-2.4.4/include -I/usr/include -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I/usr/local/include   -fpic  -g -O2  -c zm_range.cpp -o zm_range.o
g++ -std=gnu++11 -shared -L/software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/lib -L/usr/local/lib64 -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 mdim.o ops.o polygonize.o proj.o proj_info.o raster2sf.o sfg.o signed_area.o stars.o wkb.o zm_range.o -lproj -L/software/c4/cbi/software/gdal-2.4.4/lib -lgdal -L/usr/lib64 -lgeos_c -L/software/c4/cbi/software/R-4.1.2-gcc8/lib64/R/lib -lR
installing to /c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/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)

@HenrikBengtsson
Copy link
Author

Looks like this one's solved. I let you guys decided when to close this issue.

@HenrikBengtsson HenrikBengtsson changed the title sf 1.0-6 requires GDAL (>= 3.0.0)? sf 1.0-6 requires GDAL (>= 3.0.0)? [SOLVED for sf 1.0-7] Feb 5, 2022
@HenrikBengtsson
Copy link
Author

My only suggestion would be to set up a GitHub Action that runs R CMD check with these older versions.

@stragu
Copy link

stragu commented Feb 9, 2022

Also confirming that, after getting the 'class OGRSpatialReference' has no member named 'SetAxisMappingStrategy' error when updating to 1.0-6, devtools::install_github("r-spatial/sf") does not error now, on Ubuntu 18.04.6.
Thanks for the quick fix!

@HenrikBengtsson
Copy link
Author

What's an ETA for releasing a fixed version to CRAN?

@edzer
Copy link
Member

edzer commented Mar 7, 2022

Now on CRAN.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants