Skip to content

Installation fails on R 4.5.3 due to sf / s2 compilation errors #6

@asmlgkj

Description

@asmlgkj

Hi, SpatialCellChat is a great tool for spatial cell-cell communication analysis. We are excited to use it in our spatial transcriptomics projects. Thank you for developing and sharing this excellent package with the community.

Installation fails on R 4.5.3 due to sf / s2 compilation errors

Environment

  • OS: Ubuntu 24.04 (Linux HPC cluster)
  • R version: 4.5.3 (2026-03-11)
  • Installation method: devtools::install_github("jinworks/SpatialCellChat")
  • Package manager: conda (miniforge3)

Problem

Installing SpatialCellChat on R 4.5.3 fails due to a chain of dependency compilation errors:

  1. s2 package fails to compile — linker cannot find multiple abseil-cpp shared libraries:
ld: cannot find -labsl_log_internal_check_op: No such file or directory
ld: cannot find -labsl_log_internal_conditions: No such file or directory
ld: cannot find -labsl_string_view: No such file or directory
... (17 missing libraries total)
collect2: error: ld returned 1 exit status
ERROR: compilation failed for package 's2'
  1. sf fails because it depends on s2:
ERROR: dependency 's2' is not available for package 'sf'
  1. SpatialCellChat fails because it depends on sf:
ERROR: dependency 'sf' is not available for package 'SpatialCellChat'

Additional issues

  • systemfonts also fails to compile due to missing ft2build.h (freetype2 header not on default include path). This blocks ggforcescatterpiespacexr installation chain.
  • Bioconductor dependencies (ALRA, MERINGUE, ComplexHeatmap, BiocNeighbors) are not available via install.packages() and require separate installation from GitHub/Bioconductor.

Attempted workarounds

  • Installing abseil-cpp and openssl via conda — did not resolve the s2 linker errors.
  • install.packages("sf", configure.args = c(sf = "--without-s2")) — did not take effect; s2 was still attempted.
  • Installing r-sf via conda — this silently downgraded R from 4.5.3 to 4.4.3 (since conda-forge r-sf only has R 4.4 builds), breaking all previously compiled R 4.5 packages.

Questions

  1. Is sf (and therefore s2) strictly required for SpatialCellChat, or can it work without spatial geometry operations from sf?
  2. Could sf be made an optional dependency (moved to Suggests instead of Imports)?
  3. Are there any known working installation instructions for R 4.5.x?

Suggested improvement

Consider documenting the full list of system-level dependencies required for compilation (e.g., freetype-dev, abseil-cpp, gdal, proj, geos, udunits2) and providing a conda/apt install command in the README to help users set up their environment before installing from R.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions