Skip to content
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

sf 1.0-17 fails to install with GDAL < 3.4: gdal.cpp:713:16: error: ‘ret’ was not declared in this scope #2436

Closed
HenrikBengtsson opened this issue Sep 11, 2024 · 22 comments

Comments

@HenrikBengtsson
Copy link

Issue

> install.packages("sf")
Installing package into '/wynton/home/cbi/hb/R/rocky8-x86_64-pc-linux-gnu-library/4.4-CBI-gcc13'
(as 'lib' is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/sf_1.0-17.tar.gz'
Content type 'application/x-gzip' length 3802276 bytes (3.6 MB)
==================================================
downloaded 3.6 MB

* installing *source* packagesf...
** packagesfsuccessfully unpacked and MD5 sums checked
** 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.2
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.7.2
checking GEOS version >= 3.4.0... yes
checking for geos_c.h... yes
checking geos: linking with -L/usr/lib64 -lgeos_c... yes
configure: Package CPP flags:   -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include
configure: Package LIBS: -lproj    -L/usr/lib64 -lgdal -L/usr/lib64 -lgeos_c
configure: creating ./config.status
config.status: creating src/Makevars
** libs
using C++ compiler:g++ (GCC) 13.2.1 20231205 (Red Hat 13.2.1-6)’
g++ -std=gnu++17 -I"/wynton/home/cbi/shared/software/CBI/_rocky8/R-4.4.1-gcc13/lib64/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/wynton/home/cbi/hb/R/rocky8-x86_64-pc-linux-gnu-library/4.4-CBI-gcc13/Rcpp/include' -I/usr/local/include    -fpic
 -g -O2   -c RcppExports.cpp -o RcppExports.o
g++ -std=gnu++17 -I"/wynton/home/cbi/shared/software/CBI/_rocky8/R-4.4.1-gcc13/lib64/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/wynton/home/cbi/hb/R/rocky8-x86_64-pc-linux-gnu-library/4.4-CBI-gcc13/Rcpp/include' -I/usr/local/include    -fpic
 -g -O2   -c bbox.cpp -o bbox.o
g++ -std=gnu++17 -I"/wynton/home/cbi/shared/software/CBI/_rocky8/R-4.4.1-gcc13/lib64/R/include" -DNDEBUG -DHAVE_PROJ_H -I/usr/include/gdal -I/usr/include -I'/wynton/home/cbi/hb/R/rocky8-x86_64-pc-linux-gnu-library/4.4-CBI-gcc13/Rcpp/include' -I/usr/local/include    -fpic
 -g -O2   -c gdal.cpp -o gdal.o
gdal.cpp: In functionRcpp::NumericVector CPL_transform_bounds(Rcpp::NumericVector, Rcpp::List, int)’:
gdal.cpp:713:16: error:retwas not declared in this scope
  713 |         return ret;
      |                ^~~
make: *** [/wynton/home/cbi/shared/software/CBI/_rocky8/R-4.4.1-gcc13/lib64/R/etc/Makeconf:204: gdal.o] Error 1
ERROR: compilation failed for packagesf* removing/wynton/home/cbi/hb/R/rocky8-x86_64-pc-linux-gnu-library/4.4-CBI-gcc13/sf

This is because ret in:

sf/src/gdal.cpp

Line 713 in 061196e

return ret;

is never refined for GDAL_VERSION_NUM < 3040000.

@weathermiya
Copy link

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

@HenrikBengtsson HenrikBengtsson changed the title sf 1.0-17 fail to install with GDAL < 3.4: gdal.cpp:713:16: error: ‘ret’ was not declared in this scope sf 1.0-17 fails to install with GDAL < 3.4: gdal.cpp:713:16: error: ‘ret’ was not declared in this scope Sep 11, 2024
@rsbivand
Copy link
Member

@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.

@pat-s
Copy link
Member

pat-s commented Sep 11, 2024

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.

@rsbivand
Copy link
Member

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?

@rsbivand
Copy link
Member

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?

@weathermiya
Copy link

weathermiya commented Sep 11, 2024

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!

rsbivand added a commit to rsbivand/sf that referenced this issue Sep 11, 2024
@rsbivand
Copy link
Member

#2437 created.

@pat-s
Copy link
Member

pat-s commented Sep 11, 2024

Work on RHEL8 with GDAL 3.0.4.

@rsbivand
Copy link
Member

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?

edzer added a commit that referenced this issue Sep 11, 2024
@rsbivand
Copy link
Member

Following the merge, could someone with GDAL < 3.4.0 try remotes::install_github("r-spatial/sf") ?

@stevenolen
Copy link

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)

@farhadsalimi
Copy link

farhadsalimi commented Sep 12, 2024

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)

  • installing source package ‘sf’ ...
    ** using staged installation
    ERROR: 'configure' exists but is not executable -- see the 'R Installation and Administration Manual'
  • removing ‘/home/fa079944/R/x86_64-pc-linux-gnu-library/4.2/sf’
    Warning message:
    In i.p(...) :
    installation of package ‘/tmp/RtmplznSaA/filed7422760f7c25/sf_1.0-18.tar.gz’ had non-zero exit status

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)

  • installing source package ‘sf’ ...
    ** using staged installation
    configure: CC: gcc
    configure: CXX: g++ -std=gnu++14
    checking for gdal-config... /usr/local/bin/gdal-config
    checking gdal-config usability... yes
    configure: GDAL: 2.2.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/local/share/gdal/pcs.csv readable... yes
    checking GDAL: checking whether PROJ is available for linking:... yes
    checking GDAL: checking whether PROJ is available for running:... yes
    configure: GDAL: 2.2.4
    checking for proj.h... no
    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.5.0
    checking GEOS version >= 3.4.0... yes
    checking for geos_c.h... yes
    checking geos: linking with -L/usr/lib64 -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/lib64 -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 -I/usr/local/include -I/usr/include -I'/home/fa079944/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 -I/usr/local/include -I/usr/include -I'/home/fa079944/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 -I/usr/local/include -I/usr/include -I'/home/fa079944/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 -I/usr/local/include -I/usr/include -I'/home/fa079944/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 -I/usr/local/include -I/usr/include -I'/home/fa079944/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 -I/usr/local/include -I/usr/include -I'/home/fa079944/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 -I/usr/local/include -I/usr/include -I'/home/fa079944/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 -I/usr/local/include -I/usr/include -I'/home/fa079944/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 -I/usr/local/include -I/usr/include -I'/home/fa079944/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 -I/usr/local/include -I/usr/include -I'/home/fa079944/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 -I/usr/local/include -I/usr/include -I'/home/fa079944/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 -I/usr/local/include -I/usr/include -I'/home/fa079944/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 -I/usr/local/include -I/usr/include -I'/home/fa079944/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 -I/usr/local/include -I/usr/include -I'/home/fa079944/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 -I/usr/local/include -I/usr/include -I'/home/fa079944/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 -I/usr/local/include -I/usr/include -I'/home/fa079944/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 -I/usr/local/include -I/usr/include -I'/home/fa079944/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 -I/usr/local/include -I/usr/include -I'/home/fa079944/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 -I/usr/local/include -I/usr/include -I'/home/fa079944/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 -I/usr/local/include -I/usr/include -I'/home/fa079944/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 -I/usr/local/include -I/usr/include -I'/home/fa079944/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/opt/R/4.2.2/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 -L/usr/local/lib -lgdal -lproj -L/usr/local/lib -lgdal -L/usr/lib64 -lgeos_c -L/opt/R/4.2.2/lib/R/lib -lR
    installing to /home/fa079944/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
    converting help for package ‘sf’
    finding HTML links ... done
    Ops html
    aggregate.sf html
    bind html
    coerce-methods html
    dbDataType html
    dbWriteTable html
    db_drivers html
    dot-stop_geos html
    extension_map html
    gdal html
    gdal_addo html
    gdal_utils html
    geos_binary_ops html
    geos_binary_pred html
    geos_combine html
    geos_measures html
    geos_query html
    geos_unary html
    interpolate_aw html
    is_driver_available html
    is_driver_can html
    is_geometry_column html
    merge.sf html
    nc html
    plot html
    prefix_map html
    proj_tools html
    rawToHex html
    reexports html
    s2 html
    sf-defunct html
    sf-package html
    sf html
    sf_extSoftVersion html
    sf_project html
    sfc html
    sgbp html
    st html
    st_agr html
    st_as_binary html
    st_as_grob html
    st_as_sf html
    st_as_sfc html
    st_as_text html
    st_bbox html
    st_break_antimeridian html
    st_cast html
    st_cast_sfc_default html
    st_collection_extract html
    st_coordinates html
    st_crop html
    st_crs html
    st_drivers html
    st_geometry html
    st_geometry_type html
    st_graticule html
    st_is html
    st_is_longlat html
    st_jitter html
    st_join html
    st_layers html
    st_line_project_point html
    st_line_sample html
    st_m_range html
    st_make_grid html
    st_nearest_feature html
    st_nearest_points html
    st_normalize html
    st_precision html
    st_read html
    st_relate html
    st_sample html
    st_shift_longitude html
    st_transform html
    st_viewport html
    st_write html
    st_z_range html
    st_zm html
    stars html
    summary.sfc html
    tibble html
    tidyverse html
    transform.sf html
    valid html
    vctrs html
    *** 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

Any news on a CRAN submission? HPC users on Rocky 8 are starting to report on this problem (there are ~1500 users on our end).

@sacdosse
Copy link

sacdosse commented Sep 30, 2024

Hi,
On RHEL9, with GEOS 3.10.1 (rpm installed), and GDAL 2.4.4 and PROJ 7.2.1 both installed in ~/.local, I get the "gdal.cpp:713:16: error: ‘ret’ was not declared in this scope" error while trying to installed "sf" in command line:

$ export LD_LIBRARY_PATH=~/.local/lib
$ R

R version 4.3.3 (2024-02-29) -- "Angel Food Cake"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> install.packages('sf', repos="http://cran.r-project.org", configure.args=c("--with-proj-lib=/pbs/home/d/dbouvet/.local/lib --with-proj-include=/pbs/home/d/dbouvet/.local/include --with-gdal-config=/pbs/home/d/dbouvet/.local/bin/gdal-config"), lib="/pbs/home/d/dbouvet/products/R/library/sf")
trying URL 'http://cran.r-project.org/src/contrib/sf_1.0-17.tar.gz'
Content type 'application/x-gzip' length 3802276 bytes (3.6 MB)
==================================================
downloaded 3.6 MB

* installing *source* package ‘sf’ ...
** package ‘sf’ successfully unpacked and MD5 sums checked
** using staged installation
configure: CC: gcc
configure: CXX: g++ -std=gnu++17
configure: gdal-config set to /pbs/home/d/dbouvet/.local/bin/gdal-config
checking gdal-config exists... yes
checking gdal-config executable... yes
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 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: /pbs/home/d/dbouvet/.local/share/gdal/pcs.csv readable... yes
checking GDAL: checking whether PROJ is available for linking:... yes
checking GDAL: checking whether PROJ is available for running:... yes
configure: GDAL: 2.4.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.10.1
checking GEOS version >= 3.4.0... yes
checking for geos_c.h... yes
checking geos: linking with -L/usr/lib64 -lgeos_c... yes
configure: Package CPP flags:  -I/pbs/home/d/dbouvet/.local/include -DHAVE_PROJ_H -I/pbs/home/d/dbouvet/.local/include -I/usr/include
configure: Package LIBS: -L/pbs/home/d/dbouvet/.local/lib  -lproj  -L/pbs/home/d/dbouvet/.local/lib -lgdal -L/usr/lib64 -lgeos_c
configure: creating ./config.status
config.status: creating src/Makevars
** libs
using C++ compiler: ‘g++ (GCC) 11.4.1 20231218 (Red Hat 11.4.1-3)’
g++ -std=gnu++17 -I"/pbs/software/redhat-9-x86_64/R/4.3.3/lib64/R/include" -DNDEBUG -I/pbs/home/d/dbouvet/.local/include -DHAVE_PROJ_H -I/pbs/home/d/dbouvet/.local/include -I/usr/include -I'/pbs/software/redhat-9-x86_64/R/4.3.3/lib64/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c RcppExports.cpp -o RcppExports.o
g++ -std=gnu++17 -I"/pbs/software/redhat-9-x86_64/R/4.3.3/lib64/R/include" -DNDEBUG -I/pbs/home/d/dbouvet/.local/include -DHAVE_PROJ_H -I/pbs/home/d/dbouvet/.local/include -I/usr/include -I'/pbs/software/redhat-9-x86_64/R/4.3.3/lib64/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c bbox.cpp -o bbox.o
g++ -std=gnu++17 -I"/pbs/software/redhat-9-x86_64/R/4.3.3/lib64/R/include" -DNDEBUG -I/pbs/home/d/dbouvet/.local/include -DHAVE_PROJ_H -I/pbs/home/d/dbouvet/.local/include -I/usr/include -I'/pbs/software/redhat-9-x86_64/R/4.3.3/lib64/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c gdal.cpp -o gdal.o
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: *** [/pbs/software/redhat-9-x86_64/R/4.3.3/lib64/R/etc/Makeconf:200: gdal.o] Error 1
ERROR: compilation failed for package ‘sf’
* removing ‘/pbs/home/d/dbouvet/products/R/library/sf/sf’

The downloaded source packages are in
	‘/scratch/users/d/dbouvet/RtmpXo6BX7/downloaded_packages’
Warning message:
In install.packages("sf", repos = "http://cran.r-project.org", configure.args = c("--with-proj-lib=/pbs/home/d/dbouvet/.local/lib --with-proj-include=/pbs/home/d/dbouvet/.local/include --with-gdal-config=/pbs/home/d/dbouvet/.local/bin/gdal-config"),  :
  installation of package ‘sf’ had non-zero exit status
> 

Any clue?

@edzer
Copy link
Member

edzer commented Sep 30, 2024

Yes, please install from github, e.g. with remotes::install_github("r-spatial/sf").

@sacdosse
Copy link

sacdosse commented Oct 1, 2024

Thanks @edzer.
I tried the following:

> remotes::install_github("r-spatial/sf", INSTALL_opts = c("--with-proj-lib=/pbs/home/d/dbouvet/.local/lib --with-proj-include=/pbs/home/d/dbouvet/.local/include --with-gdal-config=/pbs/home/d/dbouvet/.local/bin/gdal-config"), lib="/pbs/home/d/dbouvet/products/R/library/sf")
Downloading GitHub repo r-spatial/sf@HEAD
These packages have more recent versions available.
It is recommended to update all of them.
Which would you like to update?

1: All                            
2: CRAN packages only             
3: None                           
4: Rcpp  (1.0.12 -> 1.0.13) [CRAN]
5: wk    (0.9.1  -> 0.9.3 ) [CRAN]
6: e1071 (1.7-14 -> 1.7-16) [CRAN]
7: s2    (1.1.6  -> 1.1.7 ) [CRAN]
8: DBI   (1.2.2  -> 1.2.3 ) [CRAN]

Enter one or more numbers, or an empty line to skip updates: 
Installing 1 packages: units
trying URL 'https://cloud.r-project.org/src/contrib/units_0.8-5.tar.gz'
Content type 'application/x-gzip' length 247974 bytes (242 KB)
==================================================
downloaded 242 KB

Warning: unknown option ‘--with-proj-lib=/pbs/home/d/dbouvet/.local/lib’
Warning: unknown option ‘--with-proj-include=/pbs/home/d/dbouvet/.local/include’
Warning: unknown option ‘--with-gdal-config=/pbs/home/d/dbouvet/.local/bin/gdal-config’
* installing *source* package ‘units’ ...
** package ‘units’ successfully unpacked and MD5 sums checked
** using staged installation
configure: units: 0.8-5
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 g++ -std=gnu++17 accepts -g... yes
checking for g++ -std=gnu++17 option to enable C++11 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 _Bool... no
checking for stdbool.h that conforms to C99... yes
checking for error_at_line... yes
checking for gcc... gcc
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 XML_ParserCreate in -lexpat... yes
checking for udunits2.h... no
checking for udunits2/udunits2.h... yes
checking for ut_read_xml in -ludunits2... yes
configure: creating ./config.status
config.status: creating src/Makevars
** libs
using C++ compiler: ‘g++ (GCC) 11.4.1 20231218 (Red Hat 11.4.1-3)’
g++ -std=gnu++17 -I"/pbs/software/redhat-9-x86_64/R/4.3.3/lib64/R/include" -DNDEBUG -DUDUNITS2_DIR=1   -I/usr/local/include -I'/pbs/software/redhat-9-x86_64/R/4.3.3/lib64/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c RcppExports.cpp -o RcppExports.o
g++ -std=gnu++17 -I"/pbs/software/redhat-9-x86_64/R/4.3.3/lib64/R/include" -DNDEBUG -DUDUNITS2_DIR=1   -I/usr/local/include -I'/pbs/software/redhat-9-x86_64/R/4.3.3/lib64/R/library/Rcpp/include' -I/usr/local/include    -fpic  -g -O2  -c udunits.cpp -o udunits.o
g++ -std=gnu++17 -shared -L/pbs/software/redhat-9-x86_64/R/4.3.3/lib64/R/lib -L/usr/local/lib64 -o units.so RcppExports.o udunits.o -lexpat -lexpat -ludunits2 -L/pbs/software/redhat-9-x86_64/R/4.3.3/lib64/R/lib -lR
installing to /pbs/home/d/dbouvet/products/R/library/sf/00LOCK-units/00new/units/libs
** R
** demo
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** 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 (units)

The downloaded source packages are in
	‘/scratch/users/d/dbouvet/RtmpKGyCeD/downloaded_packages’
── R CMD build ───────────────────────────────────────────────────────────────────────────────────────────────────────────────
✔  checking for file ‘/scratch/users/d/dbouvet/RtmpKGyCeD/remotes28422a7a6bcef7/r-spatial-sf-39da056/DESCRIPTION’ ...
─  preparing ‘sf’: (1.5s)
✔  checking DESCRIPTION meta-information ...
─  cleaning src
─  running ‘cleanup’
─  checking for LF line-endings in source and make files and shell scripts (980ms)
─  checking for empty or unneeded directories
─  building ‘sf_1.0-18.tar.gz’
   
Warning: unknown option ‘--with-proj-lib=/pbs/home/d/dbouvet/.local/lib’
Warning: unknown option ‘--with-proj-include=/pbs/home/d/dbouvet/.local/include’
Warning: unknown option ‘--with-gdal-config=/pbs/home/d/dbouvet/.local/bin/gdal-config’
* 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.4.3
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:... ERROR 1: PROJ: proj_create_from_database: /pbs/home/d/dbouvet/.local/share/proj/proj.db contains DATABASE.LAYOUT.VERSION.MINOR = 0 whereas a number >= 2 is expected. It comes from another PROJ installation.
ERROR 1: PROJ: proj_create_from_database: /pbs/home/d/dbouvet/.local/share/proj/proj.db contains DATABASE.LAYOUT.VERSION.MINOR = 0 whereas a number >= 2 is expected. It comes from another PROJ installation.
ERROR 1: PROJ: proj_create: unrecognized format / unknown name
ERROR 1: PROJ: proj_create: unrecognized format / unknown name
no
configure: error: OGRCoordinateTransformation() does not return a coord.trans: PROJ not available?
ERROR: configuration failed for package ‘sf’
* removing ‘/pbs/home/d/dbouvet/products/R/library/sf/sf’
Warning message:
In i.p(...) :
  installation of package ‘/scratch/users/d/dbouvet/RtmpKGyCeD/file28422a404dace9/sf_1.0-18.tar.gz’ had non-zero exit status

but it failed because PROJ and GDAL were not found as --with-proj-lib, --with-proj-include and --with-gdal-config are unrecognized options.
What is the correct sentence for these options with remotes::install_github?

@edzer
Copy link
Member

edzer commented Oct 1, 2024

That error might indicate that you have more than one instance (and version) of PROJ installed on your system; see the README.md.

@sacdosse
Copy link

sacdosse commented Oct 1, 2024

PROJ 8.2.0 is installed via rpm with RHEL9. But as "sf" needs pcs.csv, I had to installed PROJ 7.2.1 in ~/.local.

When trying to install with install.packages method, I already got this error on PROJ with the error /usr/share/gdal/pcs.csv readable... no. When pcs.csv was found PROJ was correctly linked.
The error on pcs.csv went away with --with-gdal-config option.
How can I pass this --with-gdal-config option to get ride of pcs.csv readable... no error?

@edzer
Copy link
Member

edzer commented Oct 1, 2024

You're hijacking this issue to get help for another, known issue; feel free to open a new issue, but I'm afraid that the general advice is to install sf on system without multiple installs of the upstream libs PROJ, GEOS or GDAL.

@edzer edzer closed this as completed Oct 1, 2024
@sacdosse
Copy link

sacdosse commented Oct 1, 2024

Finally manage to installed "sf" by initialising PATH before launching R so gdal-config is found (export PATH=~/.local/bin:$PATH)
This solved both error on pcs.csv and PROJ.

@albertus82
Copy link

Hi, v1.0-18 isn't yet available on CRAN, is there anything you can do to speedup the process? Thanks a lot!

@kadyb
Copy link
Contributor

kadyb commented Oct 11, 2024

@albertus82, version 1.0.18 is already 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

10 participants