title: R not recognizing my alternative GCC compiler after config updates?
body: <p>I followed these instructions to get R to use an alternative GCC compiler I have installed on my MacOS. </p>
  
  <p><a href="https://stackoverflow.com/questions/1616983/building-r-packages-using-alternate-gcc">Building R Packages using Alternate GCC</a></p>
  
  <p>As basic internet research will tell you (as it told me), the default compiler on the MacOS is clang / clang++, which doesn't work for my specific needs. I installed gcc-8.1 and dependencies in order to enable OpenMP on my machine. OpenMP works when I run gcc-8.1 with a standalone tmp.c file with pragma omp commands in it.</p>
  
  <p>However, when I go back to R to try to run the same code using Rcpp R package, I run into some problems.</p>
  
  <p>The below is what is in my Makevars file located at ~/.R/Makevars on my machine.</p>
  
  <pre><code>PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) $(SHLIB_OPENMP_CFLAGS)
  PKG_CFLAGS = $(SHLIB_OPENMP_CFLAGS)
  PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
  CC=gcc-8.1
  CXX=g++-8.1
  CXX98=g++-8.1
  CXX11=g++-8.1
  CXX14=g++-8.1
  CXX17=g++-8.1
  </code></pre>
  
  <p>This now correctly activates my alternative complier in lieu of clang++. I can install my package with OpenMP functionality by using a Terminal and using the R commands below. </p>
  
  <pre><code>cd /folder/where/package/is
  R CMD build packageName
  R CMD build packageName_1.0.tar.gz
  </code></pre>
  
  <p>However, I cannot install the package using devtools and roxygen2, which I would prefer. Specifically, the devtools function has_devel() fails.</p>
  
  <pre><code>has_devel()
  '/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet CMD SHLIB foo.c 
  
  gcc-8.1 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include  -fopenmp -fPIC  -Wall -g -O2  -c foo.c -o foo.o
  /bin/sh: gcc-8.1: command not found
  make: *** [foo.o] Error 127
  Error: Command failed (1)
  </code></pre>
  
  <p>Here is the code I use when trying to install updates using devtools / roxygen2.</p>
  
  <pre><code>require(Rcpp)
  require(devtools)
  require(roxygen2)
  setwd("/folder/where/package/is")
  compileAttributes(pkgdir = "/folder/where/package/is")
  install("packageName/")
  </code></pre>
  
  <p>I suspect the pop up window I get from RStudio is directly related to has_devel() function failing to be TRUE. If I revert back to using the default compiler, clang++ (by deleting my Makevars at ~/.R/Makevars), has_devel() returns TRUE and RStudio doesn't ask if I want to install developer command line tools. How can I get around this hiccup with installing a package I am developing using devtools instead of installing from source each time?</p>
  
  <p><a href="https://i.stack.imgur.com/8Hz1M.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8Hz1M.png" alt="Proof of Installed Developer Command Line Tools"></a></p>
  
  <p><a href="https://i.stack.imgur.com/05MuP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/05MuP.png" alt="R build tools error message"></a></p>