RStudio Connect with devtoolset enabled


 (While these instructions were developed for CentOS 6, they will work for CentOS 7, as well, if you are seeing the same error or would like to use a newer version of GCC.) 

When using RStudio Connect on CentOS/RHEL 6, a common issue is the GCC version available is not sufficient for C++ 2011 code.  This will return errors similar to the following for example, when installing the odbc package: 

cc1plus: error: unrecognized command line option "-std=c++11"

To work around this issue, you can install and enable the devtoolset. 

For example, on CentOS 6:

  1. yum install centos-release-scl
  2. yum install devtoolset-7
  3. Execute: gcc -v
  4. Enable devtoolset-7 with:  source scl_source enable devtoolset-7
  5. Review gcc version now with:  gcc -v

Once tested, you can implement this on RStudio Connect using a program supervisor.

For example:

1.  Create a directory to store your program supervisor script.  Note that this directory must be accessible by the sandbox.  Below is an ideal directory example:

mkdir -p /opt/scripts

2.  Script contents:

cat /opt/scripts/


echo arguments: "$@" >&2
echo >&2

source scl_source enable devtoolset-7

exec "$@"

 3. Allow access to the file with:  chmod 755 /opt/scripts/

4.  Add the following to /etc/rstudio-connect/rstudio-connect.gcfg

Supervisor = /opt/scripts/

Afterwards, please restart the RStudio Connect service. 

When content is deployed, you should see the new GCC version in use to compile packages.  This will allow you to deploy content using R packages which require a C++ 11 compatible compiler.