[Rcpp-devel] Cannot run rcpp due to missing include file(s)
Carl Ganz
carlganz at gmail.com
Sun May 3 19:04:29 CEST 2020
This is probably beyond my understanding at this point, but the solution I
offered worked for me with R 4.0 and it looks like this example is R 3.6
I vaguely remember some issues with interaction between older R version and
newer Xcode 11.4.1 so moving to R 4 might help
On Sun, May 3, 2020 at 9:25 AM Paul Fishwick <metaphorz at gmail.com> wrote:
> Carl
>
> First, thank you for this quick tip! I had no ~/.R directory and Makevars
> didn’t exist when I searched
>
> for it in Finder. So, I made the directdory ~/.R and then added a new file
> “Makevars” to that directory.
>
> I edited this file to add your PKG_CPPFLAGS:
>
>
>
> (base) <hostname>-5:.R paul$ more Makevars
>
>
> PKG_CPPFLAGS=-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
>
>
>
> Now I get another sequence of compiler errors. I’ll include only the first
> several lines:
>
>
>
> ……….
>
>
>
> In file included from fileb6e52d3a23c3.cpp:1:
>
> 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:
>
> /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
>
> using ::signbit;
>
> ~~^
>
> /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
>
> using ::fpclassify;
>
> ~~^
>
> /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'?
>
> using ::isfinite;
>
> ~~^
>
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/math.h:749:12:
> note: 'finite' declared here
>
> extern int finite(double)
>
> ^
>
>
>
> *From: *Carl Ganz <carlganz at gmail.com>
> *Date: *Sunday, May 3, 2020 at 11:02 AM
> *To: *Paul Fishwick <metaphorz at gmail.com>
> *Cc: *<rcpp-devel at lists.r-forge.r-project.org>
> *Subject: *Re: [Rcpp-devel] Cannot run rcpp due to missing include file(s)
>
>
>
> 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
>
>
>
> 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
>
>
>
> On Sun, May 3, 2020 at 8:59 AM Paul Fishwick <metaphorz at gmail.com> wrote:
>
>
>
>
> System: Mac OSX 11 (Catalina), Rstudio with R version 3.6.3 (but have also
> tried 4.0 and 3.3),
>
> Xcode version 11.4.1
>
>
>
> Went to: http://adv-r.had.co.nz/Rcpp.html#rcpp-intro
>
>
>
> and tried library(rcpp) which worked fine because I previously had
> installed the rcpp package.
>
>
>
> The following yields an error in finding config.h. I did a "find" on
> config.h and sure enough it is not
>
> in the clang++ -I directory references. Here is what I have tried:
>
>
>
> Installing Xcode's command line tools (which were installed using
> xcode-select --install)
>
> Also, downloaded and installed the version of clang8 and gfortran6.1 from:
>
>
>
> https://cran.r-project.org/bin/macosx/tools/
>
>
>
> The following error occurs when I try this rcpp example from Hadley but it
> also happens whenever
>
> I try to install an R package from source. The compile fails due to not
> finding some include file.
>
>
>
> I would have thought that installing clang8 would have also included the
> proper include (.h) file directories
>
> with their contents needed by R.
>
>
>
> Is there something I am missing below? Thank you.
>
>
>
> > library(Rcpp)
> > cppFunction('int add(int x, int y, int z) {
> + int sum = x + y + z;
> + return sum;
> + }')
> In file included from fileb6e52d3a23c3.cpp:1:
> 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:
> In file included from /usr/local/include/math.h:8:
> In file included from /usr/local/include/features.h:10:
> /usr/local/include/forwards.h:10:10: fatal error: 'config.h' file not found
> #include "config.h"
> ^~~~~~~~~~
> 1 error generated.
> make: *** [fileb6e52d3a23c3.o] Error 1
> 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
> Error in sourceCpp(code = code, env = env, rebuild = rebuild, cacheDir =
> cacheDir, :
> Error 1 occurred building shared library.
> >
>
> _______________________________________________
> Rcpp-devel mailing list
> Rcpp-devel at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20200503/62ff08da/attachment.html>
More information about the Rcpp-devel
mailing list