RStudio Workbench / RStudio Server Pro with devtoolset enabled


When using RStudio Workbench (previously RStudio Server Pro) 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"


fatal error: codecvt: No such file or directory


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

For example, on CentOS 6:

(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.) 


  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 Workbench by using the rsession-profile

For example:


1.  Create the /etc/rstudio/rsession-profile.

vi /etc/rstudio/rsession-profile


2.  rsession-profile contents:

source scl_source enable devtoolset-7


3. Allow access to the file with:

chmod 755 /etc/rstudio/rsession-profile

4.  This will apply to all new sessions now.  You may wish to restart the service to force any existing sessions to reload.


To verify the change from the IDE on a new session, execute:

system("gcc -v")

Example output:

Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/opt/rh/devtoolset-7/root/usr --mandir=/opt/rh/devtoolset-7/root/usr/share/man --infodir=/opt/rh/devtoolset-7/root/usr/share/info --with-bugurl= --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --enable-plugin --with-linker-hash-style=gnu --enable-initfini-array --with-default-libstdcxx-abi=gcc4-compatible --with-isl=/builddir/build/BUILD/gcc-7.2.1-20170829/obj-x86_64-redhat-linux/isl-install --enable-libmpx --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 7.2.1 20170829 (Red Hat 7.2.1-1) (GCC)


If you're using the Job Launcher to launch non-local sessions (using Slurm or Kubernetes), devtoolset will need to be installed and enabled wherever the sessions are running as well.