<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Menlo;
        panose-1:2 11 6 9 3 8 4 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
p.p1, li.p1, div.p1
        {mso-style-name:p1;
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.5pt;
        font-family:Menlo;
        color:black;}
span.s1
        {mso-style-name:s1;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal>Carl<o:p></o:p></p><p class=MsoNormal> First, thank you for this quick tip! I had no ~/.R directory and Makevars didn’t exist when I searched<o:p></o:p></p><p class=MsoNormal>for it in Finder. So, I made the directdory ~/.R and then added a new file “Makevars” to that directory.<o:p></o:p></p><p class=MsoNormal>I edited this file to add your PKG_CPPFLAGS:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=p1><span class=s1>(base) <hostname>-5:.R paul$ more Makevars</span><o:p></o:p></p><p class=p1><span class=s1>PKG_CPPFLAGS=-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include</span><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Now I get another sequence of compiler errors. I’ll include only the first several lines:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>……….<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>In file included from fileb6e52d3a23c3.cpp:1:<o:p></o:p></p><p class=MsoNormal>In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include/Rcpp.h:27:<o:p></o:p></p><p class=MsoNormal>In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include/RcppCommon.h:29:<o:p></o:p></p><p class=MsoNormal>In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include/Rcpp/r/headers.h:67:<o:p></o:p></p><p class=MsoNormal>In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include/Rcpp/platform/compiler.h:100:<o:p></o:p></p><p class=MsoNormal>/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:317:9: error: no member named 'signbit' in the global namespace<o:p></o:p></p><p class=MsoNormal>using ::signbit;<o:p></o:p></p><p class=MsoNormal>      ~~^<o:p></o:p></p><p class=MsoNormal>/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:318:9: error: no member named 'fpclassify' in the global namespace<o:p></o:p></p><p class=MsoNormal>using ::fpclassify;<o:p></o:p></p><p class=MsoNormal>      ~~^<o:p></o:p></p><p class=MsoNormal>/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:319:9: error: no member named 'isfinite' in the global namespace; did you mean 'finite'?<o:p></o:p></p><p class=MsoNormal>using ::isfinite;<o:p></o:p></p><p class=MsoNormal>      ~~^<o:p></o:p></p><p class=MsoNormal>/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/math.h:749:12: note: 'finite' declared here<o:p></o:p></p><p class=MsoNormal>extern int finite(double)<o:p></o:p></p><p class=MsoNormal>           ^<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:12.0pt;color:black'>From: </span></b><span style='font-size:12.0pt;color:black'>Carl Ganz <carlganz@gmail.com><br><b>Date: </b>Sunday, May 3, 2020 at 11:02 AM<br><b>To: </b>Paul Fishwick <metaphorz@gmail.com><br><b>Cc: </b><rcpp-devel@lists.r-forge.r-project.org><br><b>Subject: </b>Re: [Rcpp-devel] Cannot run rcpp due to missing include file(s)<o:p></o:p></span></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><div><p class=MsoNormal>I experienced similar issues on Mac and was able to fix by adding PKG_CPPFLAGS=-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include to my .R/Makevars<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>My understanding is that Mac no longer uses the /usr/local/include so you need to point it to the usr/include in the Developer SDK folder<o:p></o:p></p></div></div><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal>On Sun, May 3, 2020 at 8:59 AM Paul Fishwick <<a href="mailto:metaphorz@gmail.com">metaphorz@gmail.com</a>> wrote:<o:p></o:p></p></div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in'><div><div><p class=MsoNormal><o:p> </o:p></p></div><p class=MsoNormal><br clear=all><o:p></o:p></p><div><div><div><div><div><div><p class=MsoNormal>System: Mac OSX 11 (Catalina), Rstudio with R version 3.6.3 (but have also tried 4.0 and 3.3),<o:p></o:p></p></div></div><div><p class=MsoNormal>Xcode version 11.4.1<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Went to:  <a href="http://adv-r.had.co.nz/Rcpp.html#rcpp-intro" target="_blank">http://adv-r.had.co.nz/Rcpp.html#rcpp-intro</a><o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>and tried library(rcpp) which worked fine because I previously had installed the rcpp package.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>The following yields an error in finding config.h. I did a "find" on config.h and sure enough it is not<o:p></o:p></p></div><div><p class=MsoNormal>in the clang++ -I directory references. Here is what I have tried:<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Installing Xcode's command line tools (which were installed using xcode-select --install)<o:p></o:p></p></div><div><p class=MsoNormal>Also, downloaded and installed the version of clang8 and gfortran6.1 from:<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><a href="https://cran.r-project.org/bin/macosx/tools/" target="_blank">https://cran.r-project.org/bin/macosx/tools/</a><o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>The following error occurs when I try this rcpp example from Hadley but it also happens whenever<o:p></o:p></p></div><div><p class=MsoNormal>I try to install an R package from source. The compile fails due to not finding some include file.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>I would have thought that installing clang8 would have also included the proper include (.h) file directories<o:p></o:p></p></div><div><p class=MsoNormal>with their contents needed by R.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Is there something I am missing below? Thank you.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>> library(Rcpp)<br>> cppFunction('int add(int x, int y, int z) {<br>+   int sum = x + y + z;<br>+   return sum;<br>+ }')<br>In file included from fileb6e52d3a23c3.cpp:1:<br>In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include/Rcpp.h:27:<br>In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include/RcppCommon.h:29:<br>In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include/Rcpp/r/headers.h:67:<br>In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include/Rcpp/platform/compiler.h:100:<br>In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:304:<br>In file included from /usr/local/include/math.h:8:<br>In file included from /usr/local/include/features.h:10:<br>/usr/local/include/forwards.h:10:10: fatal error: 'config.h' file not found<br>#include "config.h"<br>         ^~~~~~~~~~<br>1 error generated.<br>make: *** [fileb6e52d3a23c3.o] Error 1<br>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"/private/var/folders/bt/1gd00p5s6n19m_bgh9b04gxc0000gp/T/RtmpRRyaky/sourceCpp-x86_64-apple-darwin15.6.0-1.0.4" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c fileb6e52d3a23c3.cpp -o fileb6e52d3a23c3.o<br>Error in sourceCpp(code = code, env = env, rebuild = rebuild, cacheDir = cacheDir,  : <br>  Error 1 occurred building shared library.<br>> <o:p></o:p></p></div></div></div></div></div></div><p class=MsoNormal>_______________________________________________<br>Rcpp-devel mailing list<br><a href="mailto:Rcpp-devel@lists.r-forge.r-project.org" target="_blank">Rcpp-devel@lists.r-forge.r-project.org</a><br><a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><o:p></o:p></p></blockquote></div></div></body></html>