[Rcpp-devel] building shared library error with sourceCpp

Simon Urbanek simon.urbanek at R-project.org
Sat Dec 28 17:45:25 CET 2019


it means you don't have command line tools installed (they are independent of Xcode and Apple OS upgrades delete things, unfortunately) - try

sudo xcode-select —install

That should fix the error you see. However, Catalina broke more things so you may look at the links Dirk pointed out if you get new errors.


> On Dec 27, 2019, at 8:16 PM, Fatima Batool <gbatoolfatima at gmail.com> 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" -DNDEBUG   -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. 
> Best wishes, 
> Fatima
> _______________________________________________
> 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

More information about the Rcpp-devel mailing list