Posit Workbench with devtoolset enabled

Follow

When using Posit Workbench with CentOS/RHEL<=7, a common issue is the GCC version available is not sufficient for C++ 2011 or higher 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"

or

fatal error: codecvt: No such file or directory

 

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

For example, on CentOS 7:

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

 

Once tested, you can implement this on Posit 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-9

 

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 --version")

Example output:

gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2)
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 

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. 

Comments