I'm trying to publish a shiny app on shinyapps.io. The app has been developed using golem. I use the last version of R and Rstudio and all packages are up to date.
Unfortunately, when I try to publish using rsconnect, the dependencies installation fails on terra with this error :
I have just hit the same issue. In my case terra is required as a dependency to leaflet. The deployment was working perfectly well until I recently updated R and so re-installed latest versions of all packages. My previous version of terra was 1.9-1. Current version is 1.9-34.
And yes, I agree, looks like a GDAL issue on server side.
Here is the exact compile error I am getting from the server:
* installing *source* package ‘terra’ ...
** this is package ‘terra’ version ‘1.9-34’
** package ‘terra’ successfully unpacked and MD5 sums checked
** using staged installation
configure: WARNING: to support parallel processing install TBB devel or update the PKG_CONFIG_PATH environment variable
** libs
specified C++17
using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0’
using C++ compiler: ‘g++ (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0’
using C++17
gdal_multidimensional.cpp: In member function ‘bool SpatRaster::open_gdal_multidim(void*&, size_t)’:
gdal_multidimensional.cpp:1090:49: error: no matching function for call to ‘GDALMDArray::AsClassicDataset(__gnu_cxx::__alloc_traits<std::allocator<long unsigned int>, long unsigned int>::value_type&, __gnu_cxx::__alloc_traits<std::allocator<long unsigned int>, long unsigned int>::value_type&, std::shared_ptr<GDALGroup>&)’
1090 | GDALDataset *cds = arr->AsClassicDataset(source[src].m_dims[0], source[src].m_dims[1], root);
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from spatVector.h:24,
from spatRaster.h:20,
from spatRasterMultiple.h:18,
from gdal_multidimensional.cpp:18:
/usr/include/gdal/gdal_priv.h:2506:26: note: candidate: ‘virtual GDALDataset* GDALMDArray::AsClassicDataset(size_t, size_t) const’
2506 | virtual GDALDataset* AsClassicDataset(size_t iXDim, size_t iYDim) const;
| ^~~~~~~~~~~~~~~~
/usr/include/gdal/gdal_priv.h:2506:26: note: candidate expects 2 arguments, 3 provided
make: *** [/opt/R/4.6.1/lib/R/etc/Makeconf:199: gdal_multidimensional.o] Error 1
ERROR: compilation failed for package ‘terra’
Looks like you have hit a limitation in our system, sorry about that. The version of terra you are using depends on GDAL behavior that was added in GDAL 3.8 but our system is currently using GDAL 3.4. If this is blocking you, you might try pinning to an older version of terra which depends on the older GDAL.
In the meantime, I'll file an issue for our infrastructure to get updated versions of these packages.
Hi, thank you! Do you have an estimate of when the updated GDAL version will be deployed to Posit Connect Cloud / shinyapps (I just saw the same problem in Posit Connect Cloud)?
We have updated GDAL in Posit Connect Cloud so this app should work there now. Shinyapps.io has not yet been udpated and I don't have an estimate for that yet.
Hi there, I am having this same issue - I use leaflet which suggests terra and although it all works locally I cannot deploy on shinyapps.io . I was wondering what version of Terra would be compatible with the GDAL on the server side - the CRAN page for terra just mentions GDAL>= 2.2.3
same issue described above with terra, R 4.6.1, and RStudio 2026.07.1
in my case downgraded to R 4.5.3 and used an older renv lockfile to restore package versions -- deploy works again
Are there any updates on when shiny apps.io will be updated? Are there any workarounds in the meantime? I am having the same issues with the gdal and terra versions due to my leaflet maps and am unable to publish.
We were having the same issue and had success deploying with the {terra} version 1.8-93. Our app was also not using {terra} specifically, but it appears to be a hard dependency of the {raster} package, which is a hard dependency of {leaflet}.
We are also working in an renv and ensured we updated our lockfile before creating the manifest.json to make explicit which {terra} package version to use in the build.
You can run the following in your R console to get and install the package version. We used the binary to avoid local compatibility issues.
Connect Cloud (Posit Connect Cloud Documentation ) on Posit does not have this issue. I would recommend deploying through them rather than shinyapps.io. I did this with code that was intended to run through Shiny without changing my code, and it still worked through Connect Cloud.
This does look more like an environment/toolchain issue than an application issue. The fact that terra fails while compiling against GDAL, and that the same package builds differently depending on the system libraries available, points in that direction.
It would be useful to know which GDAL version is currently available in the shinyapps.io build image for R 4.6.1, and whether terra 1.9-34 is expected to be compatible with it. If not, a temporary workaround might be to deploy with a known compatible R/package combination until the build image is updated.
For what it's worth, I was running up against the exact same terra/raster GDAL compatibility issue and installing the older, binary version of terra worked perfectly for me.