-
Notifications
You must be signed in to change notification settings - Fork 300
Description
Error Report: Installation Issue with sf
Package
Summary
I am experiencing difficulties installing the sf
package in my R environment. The installation process fails when attempting to run compiled C programs during the build. Below is the detailed description of the issue, including system information and steps I have taken to diagnose and attempt to resolve the problem.
System Information
- Operating System: Ubuntu 22.04
- R Version: 4.4
- sf Package Version: 1.0-19
- Conda Environment: Not Used.
- GDAL Version: 3.4.1
- GEOS Version: 3.10.2
- PROJ Version: 8.2.1
> sessionInfo()
R version 4.4.0 (2024-04-24)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 22.04.5 LTS
Matrix products: default
BLAS: /usr/local/lib/R/lib/libRblas.so
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C 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 LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
time zone: Asia/Shanghai
tzcode source: system (glibc)
attached base packages:
[1] parallel stats graphics grDevices utils datasets methods base
other attached packages:
[1] remotes_2.5.0
loaded via a namespace (and not attached):
[1] processx_3.8.4 compiler_4.4.0 R6_2.5.1 cli_3.6.3 tools_4.4.0 curl_5.2.3 desc_1.4.3
[8] callr_3.7.6 ps_1.8.0 pkgbuild_1.4.4 rlang_1.1.4 pak_0.8.0 sessioninfo_1.2.2
Error Details
During installation, I encounter the following error:
configure: error: cannot run C compiled programs. If you meant to cross compile, use --host'.
Seeconfig.log' for more details ERROR: configuration failed for package ‘sf’
> pak::pkg_install("r-spatial/sf")
→ Will install 1 package.
→ The package (0 B) is cached.
+ sf 1.0-19 [bld][cmp] (GitHub: b8e12d8) + ✔ libgdal-dev, ✔ gdal-bin, ✔ libgeos-dev, ✔ libproj-dev, ✔ libsqlite3-dev
✔ All system requirements are already installed.
ℹ No downloads are needed, 1 pkg is cached
ℹ Building sf 1.0-19
✖ Failed to build sf 1.0-19 (3.5s)
Error:
! ! error in pak subprocess
Caused by error in `stop_task_build(state, worker)`:
! Failed to build source package sf.
Full installation output:
* installing *source* package ‘sf’ ...
staged installation is only possible with locking
** using non-staged installation
configure: CC: /home/fengbx/anaconda3/envs/FBX/bin/x86_64-conda_cos6-linux-gnu-cc
configure: CXX: g++ -std=gnu++17
checking for gdal-config... /usr/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 3.4.1
checking GDAL version >= 2.0.1... yes
checking for gcc... /home/fengbx/anaconda3/envs/FBX/bin/x86_64-conda_cos6-linux-gnu-cc
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 /home/fengbx/anaconda3/envs/FBX/bin/x86_64-conda_cos6-linux-gnu-cc accepts -g... yes
checking for /home/fengbx/anaconda3/envs/FBX/bin/x86_64-conda_cos6-linux-gnu-cc 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.4.1
configure: pkg-config proj exists, will use it
configure: using proj.h.
configure: PROJ: 8.2.1
checking PROJ: checking whether PROJ and sqlite3 are available for linking:... yes
proj_conf_test.c:3:10: fatal error: proj.h: No such file or directory
#include <proj.h>
^~~~~~~~
compilation terminated.
checking for geos-config... /usr/bin/geos-config
checking geos-config usability... yes
configure: GEOS: 3.10.2
checking GEOS version >= 3.4.0... yes
checking for geos_c.h... no
configure: error: geos_c.h not found in given locations.
ERROR: configuration failed for package ‘sf’
* removing ‘/tmp/RtmpFnEmIS/pkg-lib3739a251ff4cd8/sf’
Hide Traceback
▆
1. └─pak::pkg_install("r-spatial/sf")
2. └─pak:::remote(...)
3. └─err$throw(res$error)
The build fails specifically at the point where the C compiler attempts to run compiled programs.
Steps Taken
- Verified that
geos_c.h
andproj.h
exist in/usr/include
. - Set environment variables:
C_INCLUDE_PATH
andCPLUS_INCLUDE_PATH
to/usr/include
.- Ensured
PKG_CONFIG_PATH
includes necessary directories for GEOS and PROJ.
- Confirmed the presence of all necessary development libraries (
libgdal-dev
,libgeos-dev
,libproj-dev
). - Attempted to modify the compiler and linker paths to system GCC.
- Reviewed
config.log
for any additional clues to the problem. - Attempted installation within and outside of a Conda environment.
Request for Assistance
Given the detailed steps and attempts above, could you provide guidance on additional checks or configurations necessary to resolve this installation issue?
Thank you for your assistance.