title: Compilation error in building package with RcppArmadillo codes in mac osx
body: <p>I tried to build a package that has RcppArmadillo codes, but always had encountered compilation errors. To be simple, I started without adding my own codes. I firs tried </p>
  
  <pre><code>library(Rcpp)
  Rcpp.package.skeleton("test")
  </code></pre>
  
  <p>I run "R CMD check test", and no errors returned. I then did the same thing for RcppArmadillo command as follows:</p>
  
  <pre><code>library(Rcpp)
  Rcpp.package.skeleton("test1")
  </code></pre>
  
  <p>When I run "R CMD check test1" from command line, then I got an error message as follows:</p>
  
  <pre><code>...
  * checking whether package ‘test1’ can be installed ... ERROR
  Installation failed. 
  ...
  </code></pre>
  
  <p>I further checked the 00install.out file, it says</p>
  
  <pre><code>clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/RcppArmadillo/include" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fopenmp  -fPIC  -Wall -g -O2  -c RcppExports.cpp -o RcppExports.o
  clang: error: unsupported option '-fopenmp'
  make: *** [RcppExports.o] Error 1
  ERROR: compilation failed for package ‘test1’
  </code></pre>
  
  <p>Anyone has any idea on <strong>"error: unsupported option '-fopenmp' make"</strong>? how to fix it?</p>
  
  <p>Thanks in advance!</p>
  
  <p>Update: I followed the instruction from website and did the following:
  1. update xcode
  2. brew install llvm
  3. download gcc and clang 8 from cran and installed
  4. created ~/R directory and created a file  Makevars  as follows:</p>
  
  <pre><code>  # The following statements are required to use the clang8 binary
    CC=/usr/local/clang8/bin/clang
    CXX=/usr/local/clang8/bin/clang++
    CXX11=$CXX
    CXX14=$CXX
    CXX17=$CXX
    CXX1X=$CXX
    LDFLAGS=-L/usr/local/clang8/lib
    # End clang8 inclusion statements
  </code></pre>
  
  <ol start="5">
  <li>I created test1 package (again without adding my R codes or RcppArmadillo codes). Run R CMD check test1. The Clang error is gone, but  I got the new errors:</li>
  </ol>
  
  <pre><code>/bin/sh: XX: command not found
  make: *** [RcppExports.o] Error 127
  </code></pre>
  
  <p>Any help on the new error? what is it? thanks!</p>