[Rcpp-devel] building shared library error with sourceCpp

Balamuta, James Joseph balamut2 at illinois.edu
Sun Dec 29 03:50:06 CET 2019


Fatima,

I think the ~/.R/Makevars didn’t get created correctly. In particular, the ${R_HOME} path didn’t get extended:

>  -Wl,-rpath,/lib /lib/libc++abi.1.dylib

Could you modify the ~/.R/Makevars file and ensure it has:

# clang: start
CFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
CCFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
CXXFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
CPPFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include

SHLIB_CXXLDFLAGS+=-Wl,-rpath,${R_HOME}/lib ${R_HOME}/lib/libc++abi.1.dylib
SHLIB_CXX14LDFLAGS+=-Wl,-rpath,${R_HOME}/lib ${R_HOME}/lib/libc++abi.1.dylib
# clang: end

- JJB


From: Rcpp-devel <rcpp-devel-bounces at lists.r-forge.r-project.org> on behalf of Fatima Batool <gbatoolfatima at gmail.com>
Date: Saturday, December 28, 2019 at 5:05 PM
To: Simon Urbanek <simon.urbanek at r-project.org>
Cc: "rcpp-devel at lists.r-forge.r-project.org" <rcpp-devel at lists.r-forge.r-project.org>
Subject: Re: [Rcpp-devel] building shared library error with sourceCpp

That's nothing extra, it's the first step in the link.

On Sat, Dec 28, 2019 at 2:14 PM Simon Urbanek <simon.urbanek at r-project.org<mailto:simon.urbanek at r-project.org>> wrote:
Did you follow the instructions I sent you?
Sent from my iPhone


On Dec 28, 2019, at 12:38, Fatima Batool <gbatoolfatima at gmail.com<mailto:gbatoolfatima at gmail.com>> wrote:
Hi Drik and Simon,

thanks you for the help!

I have followed all the instructions Drik mentioned here: https://thecoatlessprofessor.com/programming/cpp/r-compiler-tools-for-rcpp-on-macos/ and then run a hello world.cpp example but unfortunately the error is still there.

> Rcpp::sourceCpp('/Users/fatimabatool/documents/New/Rcodes/ASW/helloworld.cpp')
clang-7: error: no such file or directory: '/lib/libc++abi.1.dylib'
make: *** [sourceCpp_6.so] Error 1
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I../inst/include   -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/RcppArmadillo/include" -I"/Users/fatimabatool/Documents/New/Rcodes/ASW" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -c helloworld.cpp -o helloworld.o
clang++ -std=gnu++11 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -Wl,-rpath,/lib /lib/libc++abi.1.dylib -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o sourceCpp_6.so helloworld.o -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
Error in Rcpp::sourceCpp("/Users/fatimabatool/documents/New/Rcodes/ASW/helloworld.cpp") :
  Error 1 occurred building shared library.

Have removed old installation files, installed command line tools, upgraded to clang-7 and gfotron6.1. I have added set of compilation files to  ~/.R/Makevars
 as mentioned and the file exist there (attached) but there is still no CommandLineTools directory in Library/Developer. Should I try to create these myself?

Best wishes,
Fatima

On Sat, Dec 28, 2019 at 11:45 AM Simon Urbanek <simon.urbanek at r-project.org<mailto:simon.urbanek at r-project.org>> wrote:
Fatima,

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.

Cheers,
Simon



> On Dec 27, 2019, at 8:16 PM, Fatima Batool <gbatoolfatima at gmail.com<mailto: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<mailto:Rcpp-devel at lists.r-forge.r-project.org>
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
<Makevars>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20191229/b20d56b3/attachment-0001.html>


More information about the Rcpp-devel mailing list