RStudio Server Pro with devtoolset enabled


When using 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"


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


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

For example:


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

vi /etc/rstudio/rsession-profile

2.  rsession-profile contents:

cat /etc/rstudio/rsession-profile

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)