R/Shiny Application fails to stage on cflinuxfs4 due to missing geospatial libraries (GDAL, GEOS, PROJ)
search cancel

R/Shiny Application fails to stage on cflinuxfs4 due to missing geospatial libraries (GDAL, GEOS, PROJ)

book

Article ID: 447217

calendar_today

Updated On:

Products

VMware Tanzu Platform Core

Issue/Introduction

When deploying an R/Shiny application to Tanzu Application Service (TAS) using the r_buildpack on the cflinuxfs4 stack, the staging process fails during the compilation of geospatial R packages such as leafletsfterra, or units.

The staging logs typically contain errors indicating that native system libraries are missing:

  • configure: error: gdal-config not found or not executable.
  • Configuration failed because libudunits2.so was not found.
  • Could not find a package configuration file provided by "Protobuf"

These R packages require native OS shared libraries—GDAL, GEOS, PROJ, and udunits2—at both compile time (staging) and load time (runtime). These libraries are not present by default on the minimal cflinuxfs4 stack.

Resolution

To resolve this, you must provide the required native libraries using the apt-buildpack as part of a multi-buildpack deployment. This allows you to inject the necessary Ubuntu packages into the application container before the R buildpack runs.

Implementation Steps:
1. Create an apt.yml file: In your application's root directory (the same directory as your manifest.yml or r.yml), create a file named apt.yml and list the required development libraries:

---
packages:
- libgdal-dev
- libgeos-dev
- libproj-dev
- libudunits2-dev


 

2. Configure Multi-Buildpacks: Update your application manifest.yml to use both the apt_buildpack and the r_buildpack. The apt_buildpack must be listed first.

---
applications:
- name: your-r-app
  stack: cflinuxfs4
  buildpacks:
  - apt_buildpack
  - r_buildpack

 

3. Redeploy the Application: Push the application again using the Cloud Foundry CLI:

cf push

 

Support Note:

  • Apt-buildpack: The apt-buildpack is a community-maintained (third-party) buildpack. While it is the standard method for extending the stack, Broadcom does not provide official support for the buildpack itself or troubleshooting for custom-installed libraries.
  • Feature Requests: If your organization’s security policy prohibits the use of third-party buildpacks, please contact your Account Team to submit a Feature Request to have these libraries evaluated for inclusion in a future stack update.

References:

Using apt buildpack to install extra packages onto Linux container for application on Tanzu Platform for Cloud Foundry