[Rcpp-devel] Why would sourceCpp using both clang and gcc?

Dirk Eddelbuettel edd at debian.org
Sat Dec 1 01:40:09 CET 2012


On 30 November 2012 at 17:16, Thell Fowler wrote:
| Ubuntu precise with clang 3.3 and gcc 4.6.3 with R 2.15.2 and Rcpp 0.10.1 when
| calling sourceCpp gives output I'm not quite understanding...
| 
| > sourceCpp("~/src/TestPackageDepends2/inst/examples/CallFunction.cpp",verbose=
| T, rebuild=T)
| 
| Generated Rcpp module declaration:
| --------------------------------------------------------
| 
| #include <Rcpp.h>
| RCPP_MODULE(sourceCpp_12634) {
|     Rcpp::function("callFunction", &callFunction, Rcpp::List::create());
| }
| 
| Building shared library
| --------------------------------------------------------
| 
| DIR: /tmp/RtmpWMdYuo/sourcecpp_6275273d958b
| 
| /usr/lib/R/bin/R CMD SHLIB -o 'sourceCpp_12634.so' --preclean
| 'CallFunction.cpp'
| "clang++" -I/usr/share/R/include -DNDEBUG    -I"/home/thell/R/library/Rcpp/
| include" -I"/home/thell/R/library/TestPackageDepends/include"   -fpic  -O3
| -pipe  -g  -c CallFunction.cpp -o CallFunction.o
| g++ -shared -o sourceCpp_12634.so CallFunction.o -L/home/thell/R/library/Rcpp/
| lib -lRcpp -Wl,-rpath,/home/thell/R/library/Rcpp/lib -L/usr/lib/R/lib -lR
| 
| 
| What would make clang _not_ get used for both phases?  My Makevars shows
| 
| CC="clang"
| CXX="clang++"
| CPP="clang-cpp"

Because the last step is the _linking_ step and perusing the source (been
there, done that) leads to setting this at the end of my ~/.R/Makevars :

  VER=4.6
  CC=ccache gcc-$(VER)
  CXX=ccache g++-$(VER)
  SHLIB_CXXLD=g++-$(VER)      ## <-    this one
  FC=ccache gfortran
  F77=ccache gfortran
  MAKE=make -j8

  #CXX=clang++
  #CC=clang
  #CXXFLAGS=-Wall -O3 


By the way, you can also drop the quotes.

Dirk

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com  


More information about the Rcpp-devel mailing list