On trying to deploy a Shiny app to shinyapps.io, I systematically get an error caused by Rcpp failing to compile. I'm using R 4.4.3 on Windows 11 with the latest version of RStudio. The app runs fine locally and only has direct dependencies on shiny, shinyBS, shinyjs, and DT.
I've tried:
- Creating a minimal version with just core Shiny functionality
- Removing all visualization elements
- Using only base R graphics (no ggplot2)
- Deploying with only app.R and data files
I suspect this is related to the known Rcpp 1.0.13 compatibility issues with R 4.4.x described in this GitHub issue: Rcpp 1.0.13 build error with R 4.4.2 (VECTOR_PTR_RO) · Issue #1341 · RcppCore/Rcpp · GitHub
Is there a way to:
- Force shinyapps.io to use a specific version of Rcpp (1.0.10 or earlier)?
- Deploy with an older R version (4.2.x or 4.3.x)?
- Specify binary packages instead of building from source?
Here is the error log from the console:
[2025-04-10T03:53:33.004623228+0000] Building R package: Rcpp (1.0.13)
/mnt/packages/build /mnt
g++ -std=gnu++17 -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -g -O2 -c api.cpp -o api.o
g++ -std=gnu++17 -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -g -O2 -c attributes.cpp -o attributes.o
g++ -std=gnu++17 -I"/opt/R/4.4.3/lib/R/include" -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -g -O2 -c barrier.cpp -o barrier.o
- installing to library ‘/usr/lib/R’
- installing source package ‘Rcpp’ ...
** package ‘Rcpp’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
using C++ compiler: ‘g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’
In file included from barrier.cpp:31:
barrier.cpp: In function ‘SEXPREC** get_vector_ptr(SEXP)’:
../inst/include/Rcpp/r/compat.h:34:26: error: ‘VECTOR_PTR_RO’ was not declared in this scope; did you mean ‘VECTOR_PTR’?
34 | # define RCPP_VECTOR_PTR VECTOR_PTR_RO
| ^~~~~~~~~~~~~
barrier.cpp:74:30: note: in expansion of macro ‘RCPP_VECTOR_PTR’
74 | return const_cast<SEXP*>(RCPP_VECTOR_PTR(x)); // #nocov end
| ^~~~~~~~~~~~~~~
make: *** [/opt/R/4.4.3/lib/R/etc/Makeconf:204: barrier.o] Error 1
ERROR: compilation failed for package ‘Rcpp’ - removing ‘/usr/lib/R/Rcpp’## End Task Log ###################################################################################
Error: Unhandled Exception: child_task=1530509887 child_task_status=failed: Error building image: Error building Rcpp (1.0.13). Build exited with non-zero status: 1