(While these instructions were developed for CentOS 6 and devtoolset-7, they will work for CentOS 7 and devtoolset-10, 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:
- yum install centos-release-scl
- yum install devtoolset-7
- Execute: gcc -v
- Enable devtoolset-7 with: source scl_source enable devtoolset-7
- Review gcc version now with: gcc -v
Once tested, you can implement this on RStudio Connect using a program supervisor.
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:
echo arguments: "$@" >&2
source scl_source enable devtoolset-7
3. Allow access to the file with:
chmod 755 /opt/scripts/devtool-enable.sh
4. Add the following to /etc/rstudio-connect/rstudio-connect.gcfg
Supervisor = /opt/scripts/devtool-enable.sh
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.