Unable to build the Package containing Rcpp on Mac

==> Rcpp::compileAttributes()

  • Updated R/RcppExports.R

==> devtools::check(document = FALSE)

── Building ───────────────────────────────────────────────────────────────────── ETAS ──
Setting env vars:
● CFLAGS : -Wall -pedantic -fdiagnostics-color=always
● CXXFLAGS : -Wall -pedantic -fdiagnostics-color=always
● CXX11FLAGS: -Wall -pedantic -fdiagnostics-color=always
─────────────────────────────────────────────────────────────────────────────────────────
✓ checking for file ‘/Users/samarthmotagi/Desktop/ETAS/DESCRIPTION’ ...
─ preparing ‘ETAS’:
✓ checking DESCRIPTION meta-information ...
─ cleaning src
─ running ‘cleanup’
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
─ looking to see if a ‘data/datalist’ file should be added
─ building ‘ETAS_0.4.6.tar.gz’

── Checking ───────────────────────────────────────────────────────────────────── ETAS ──
Setting env vars:
R_CHECK_CRAN_INCOMING_REMOTE: FALSE
R_CHECK_CRAN_INCOMING : FALSE
R_CHECK_FORCE_SUGGESTS : FALSE
● NOT_CRAN : true
── R CMD check ─────────────────────────────────────────────────────────────────
─ using log directory ‘/Users/samarthmotagi/Desktop/ETAS.Rcheck’
─ using R version 3.6.3 (2020-02-29)
─ using platform: x86_64-apple-darwin15.6.0 (64-bit)
─ using session charset: UTF-8
─ using options ‘--no-manual --as-cran’
✓ checking for file ‘ETAS/DESCRIPTION’
─ checking extension type ... Package
─ this is package ‘ETAS’ version ‘0.4.6’
✓ checking package namespace information
✓ checking package dependencies (3.6s)
✓ checking if this is a source package
✓ checking if there is a namespace
✓ checking for executable files ...
✓ checking for hidden files and directories
✓ checking for portable file names ...
✓ checking for sufficient/correct file permissions ...
✓ checking serialization versions ...
E checking whether package ‘ETAS’ can be installed (4.4s)
Installation failed.
See ‘/Users/samarthmotagi/Desktop/ETAS.Rcheck/00install.out’ for details.

See
‘/Users/samarthmotagi/Desktop/ETAS.Rcheck/00check.log’
for details.

── R CMD check results ───────────────────────────────────────── ETAS 0.4.6 ────
Duration: 8.8s

checking whether package ‘ETAS’ can be installed ... ERROR
See below...

── Install failure ─────────────────────────────────────────────────────────────

  • installing source package ‘ETAS’ ...
    ** using staged installation
    checking whether the C++ compiler works... yes
    checking for C++ compiler default output file name... a.out
    checking for suffix of executables...
    checking whether we are cross compiling... no
    checking for suffix of object files... o
    checking whether we are using the GNU C++ compiler... yes
    checking whether clang++ accepts -g... yes
    checking how to run the C++ preprocessor... clang++ -E
    checking for clang++ option to support OpenMP... unsupported
    configure: creating ./config.status
    config.status: creating src/Makevars
    ** libs
    clang++ -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -DARMA_64BIT_WORD -fPIC -Wall -g -O2 -c RcppExports.cpp -o RcppExports.o
    clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
    In file included from RcppExports.cpp:4:
    In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include/Rcpp.h:27:
    In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include/RcppCommon.h:29:
    In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include/Rcpp/r/headers.h:67:
    In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include/Rcpp/platform/compiler.h:100:
    In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:304:
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/math.h:300:15: fatal error: 'math.h' file not found
    #include_next <math.h>
    ^~~~~~~~
    1 error generated.
    make: *** [RcppExports.o] Error 1
    ERROR: compilation failed for package ‘ETAS’
  • removing ‘/Users/samarthmotagi/Desktop/ETAS.Rcheck/ETAS’

1 error x | 0 warnings ✓ | 0 notes ✓
Error: R CMD check found ERRORs
Execution halted

Exited with status 1.