<div dir="ltr"><div>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</div><div><br></div><div>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<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, May 3, 2020 at 8:59 AM Paul Fishwick <<a href="mailto:metaphorz@gmail.com">metaphorz@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><br></div><br clear="all"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><div>System: Mac OSX 11 (Catalina), Rstudio with R version 3.6.3 (but have also tried 4.0 and 3.3),</div></div><div>Xcode version 11.4.1</div><div><br></div><div>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></div><div><br></div><div>and tried library(rcpp) which worked fine because I previously had installed the rcpp package.</div><div><br></div><div>The following yields an error in finding config.h. I did a "find" on config.h and sure enough it is not</div><div>in the clang++ -I directory references. Here is what I have tried:</div><div><br></div><div>Installing Xcode's command line tools (which were installed using xcode-select --install)</div><div>Also, downloaded and installed the version of clang8 and gfortran6.1 from:</div><div><br></div><div><a href="https://cran.r-project.org/bin/macosx/tools/" target="_blank">https://cran.r-project.org/bin/macosx/tools/</a><br></div><div><br></div><div>The following error occurs when I try this rcpp example from Hadley but it also happens whenever</div><div>I try to install an R package from source. The compile fails due to not finding some include file.</div><div><br></div><div>I would have thought that installing clang8 would have also included the proper include (.h) file directories</div><div>with their contents needed by R.</div><div><br></div><div>Is there something I am missing below? Thank you.</div><div><br></div><div>> 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>> <br></div></div></div></div></div></div>
_______________________________________________<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" rel="noreferrer" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a></blockquote></div>