Using non standard g++ compiler while Installing RcppArmadillo

I could not install RcppArmadillo package on a Rstudio server installed on a linux machine since the required g++ compiler version should be 4.7.2 or greater. The required version is in fact installed on the machine via devtoolset-6, however, that is not the default version. So my question is how do I make sure that the package gets compiled using the available, but inaccessible g++ version.?

The standard way to accomplish this is to create a file at the path ~/.R/Makevars, and set the compilers up there. See:

for more details.

1 Like

Thank you for the reply. I had looked at Makevars before, but I was not sure how exactly to use it.
Had I been able to access the compiler by some name, say gccv6, or by specifying a flag to gcc, it would be easy I could set a variable in the Makevars file. However, the only way I am aware I can access the higher version gcc is by using scl enable devtoolset-6 bash, which would ensure that the gcc command is tied to the new compiler.

Now that I think of it, it seems that adding source scl_source enable devtoolset-6 to my .bashrc might work. Unfortunately, I cannot verify this at the moment since there are some other issues with the Rstudio server installation.