r-spatial / sf

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

"sf" installation fails on RHEL 8.9 #2405

Open baderstine opened 4 months ago

baderstine commented 4 months ago

Describe the bug Attempting to install "sf" in R on RHEL 8 system fails with error message:

trying URL 'https://cloud.r-project.org/src/contrib/sf_1.0-16.tar.gz'
Content type 'application/x-gzip' length 3493756 bytes (3.3 MB)
==================================================
downloaded 3.3 MB

* installing *source* package ‘sf’ ...
** package ‘sf’ successfully unpacked and MD5 sums checked
** using staged installation
configure: CC: gcc
configure: CXX: g++ -std=gnu++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... no
checking GDAL: linking with --libs and --dep-libs... no
/usr/lib64/libgdal.so: undefined reference to `PQcmdStatus@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to `PQfname@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to `PQsetNoticeProcessor@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to `PQftable@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to `PQstatus@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to `PQftablecol@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to `PQconnectdb@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to `PQescapeStringConn@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to `lo_close@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to `PQputCopyEnd@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to `PQgetvalue@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to `PQgetisnull@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to `PQftype@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to `PQfmod@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to `lo_creat@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to `PQresultStatus@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to `lo_read@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to `PQexec@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to `PQsetClientEncoding@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to `PQgetlength@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to `PQputCopyData@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to `PQgetResult@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to `lo_write@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to `PQfinish@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to `PQclear@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to `PQerrorMessage@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to `PQnfields@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to `lo_open@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to `PQexecParams@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to `PQntuples@RHPG_9.6'
/usr/lib64/libgdal.so: undefined reference to `PQresultErrorMessage@RHPG_9.6'
collect2: error: ld returned 1 exit status
/usr/bin/ld: cannot find -larmadillo
/usr/bin/ld: cannot find -lpoppler
/usr/bin/ld: cannot find -ljson-c
/usr/bin/ld: cannot find -lfreexl
/usr/bin/ld: cannot find -lwebp
/usr/bin/ld: cannot find -lkmlbase
/usr/bin/ld: cannot find -lkmldom
/usr/bin/ld: cannot find -lkmlengine
/usr/bin/ld: cannot find -lkmlxsd
/usr/bin/ld: cannot find -lkmlregionator
/usr/bin/ld: cannot find -lxerces-c
/usr/bin/ld: cannot find -lopenjp2
/usr/bin/ld: cannot find -lnetcdf
/usr/bin/ld: cannot find -lhdf5
/usr/bin/ld: cannot find -lmfhdf
/usr/bin/ld: cannot find -ldf
/usr/bin/ld: cannot find -logdi
/usr/bin/ld: cannot find -lgif
/usr/bin/ld: cannot find -lgeotiff
/usr/bin/ld: cannot find -lgta
/usr/bin/ld: cannot find -lcfitsio
/usr/bin/ld: cannot find -ldapclient
/usr/bin/ld: cannot find -ldapserver
/usr/bin/ld: cannot find -ldap
/usr/bin/ld: cannot find -lspatialite
collect2: error: ld returned 1 exit status
configure: Install failure: compilation and/or linkage problems.
configure: error: GDALAllRegister not found in libgdal.
ERROR: configuration failed for package ‘sf’
* removing ‘/opt/R/4.3.3/lib/R/library/sf’

The downloaded source packages are in
    ‘/tmp/Rtmp0V5kUA/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("sf") :
  installation of package ‘sf’ had non-zero exit status

To Reproduce I have installed all of the recommended packages: sudo dnf install gdal-devel proj-devel geos-devel sqlite-devel udunits2-devel

then I attempt to install "sf" package in R: install.package("sf") results in the error message.

Based on the error message, there seems to be some problem with GDAL, but I am not familiar with GDAL and don't know how to debug it (or Proj, or Geos, or SQLite).

As far as I know, I've followed the installation instructions exactly but installation failed. How can I debug the installation to figure out what failed?

sessionInfo() R version 4.3.3 (2024-02-29) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Red Hat Enterprise Linux 8.9 (Ootpa) Matrix products: default BLAS/LAPACK: /usr/lib64/libopenblasp-r0.3.15.so; LAPACK version 3.9.0 locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C time zone: America/New_York tzcode source: system (glibc) attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] compiler_4.3.3 $ sudo dnf install gdal-devel proj-devel geos-devel sqlite-devel udunits2-devel Updating Subscription Management repositories. github_git-lfs 689 B/s | 833 B 00:01 github_git-lfs-source 702 B/s | 833 B 00:01 Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs) 191 kB/s | 4.5 kB 00:00 Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs) 183 kB/s | 4.1 kB 00:00 rhel8 epel 154 kB/s | 2.3 kB 00:00 Package gdal-devel-3.0.4-12.el8.x86_64 is already installed. Package proj-devel-6.3.2-4.el8.x86_64 is already installed. Package geos-devel-3.7.2-1.el8.x86_64 is already installed. Package sqlite-devel-3.26.0-19.el8_9.x86_64 is already installed. Package udunits2-devel-2.2.26-5.el8.x86_64 is already installed. Dependencies resolved. Nothing to do. Complete!
edzer commented 4 months ago

The problems seem to point to problems in the GDAL installation, potentially related to links to PostgreSQL. They don't seem to point at something that can be done here, AFAICT.