Deployment fails on shinyapps.io because of terra

Hi,

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 :

`
/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’

  • removing ‘/usr/lib/R/terra’## End Task Log ################################################################
    Erreur : Unhandled Exception: child_task=1713770840 child_task_status=failed: Error building image: Error building terra (1.9-34). Build exited with non-zero status: 1
    Exécution arrêtée
    `

EDIT: I just tried on a linux computer. Same result... which is not really surprising

Thank you for your help

2 Likes

That looks like a problem with GDAL on Posit's side to me. @kyle_hekhuis would you be able to take a look?

1 Like

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.

1 Like

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’

@samp Could you take a look at this? Kyle said to ping you instead. Thanks!

Hi Simon

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.

Sorry about that!
sam

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)?