[Rcpp-devel] Cannot run rcpp due to missing include file(s)

Paul Fishwick metaphorz at gmail.com
Sun May 3 17:59:19 CEST 2020


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.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20200503/0f6f8f61/attachment.html>


More information about the Rcpp-devel mailing list