[Rcpp-devel] building shared library error with sourceCpp

Dirk Eddelbuettel edd at debian.org
Sat Dec 28 02:32:34 CET 2019

Hi Fatima,

On 27 December 2019 at 20:16, Fatima Batool wrote:
| Hi all,
| Could anyone please advice what is going on in the following error and how
| can I fix it?
| sourceCpp("/Users/fatimabatool/documents/New/Rcodes/trial.cpp")
| clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include"
| -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include"
| -I"/Users/fatimabatool/Documents/New/Rcodes" -isysroot
| /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include
|  -fPIC  -Wall -g -O2  -c trial.cpp -o trial.o
| Error in sourceCpp("/Users/fatimabatool/documents/New/Rcodes/trial.cpp") :
|   Error 1 occurred building shared library.
| clang: warning: no such sysroot directory:
| '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
| In file included from trial.cpp:9:
| In file included from /Users/fatimabatool/Documents/New/Rcodes/trial.hpp:12:
| /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/stdio.h:108:15:
| fatal error: 'stdio.h' file not found
| #include_next <stdio.h>
|               ^~~~~~~~~
| 1 error generated.
| make: *** [trial.o] Error 1
| I was able to source all .cpp files before system updates. I have recently
| updated my MacOS to Catalina (10.15.2) and using Xcode 11.3. I am working
| in R Action of the Toe. Using version 1.0.3 of Rcpp. I have clang version
| 4.0.1.
| I have Library/Developer but no ../CommandLineTools/SDKs/MAcOSX.sdk
| subdirectories exist there.

Not a macOS user myself but please consider

 a) this older issue 

 b) this resource page for macOS it mentions

 c) pertinent entries in the Rcpp FAQ

We have seen this '#include_next <somefile.h>' error before, and I believe it
means your installation is imcomplete.  Sadly, on macOS it seems to require
quite a few steps to get everything set up...

As always, a good simple test is to see if

   Rcpp::evalCpp("2 + 2")

comes back without error and shows the expected answer...


http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org

More information about the Rcpp-devel mailing list