Skip to content

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

5 messages · JJ Allaire, Thell Fowler, Dirk Eddelbuettel

#
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"
#
All we do is call R CMD SHLIB (we don't explicitly invoke the compiler
or linker) so I think you'll have to dig into R CMD SHLIB to sort out
why this is happening.

J.J.
#
Thanks, will do.
On Fri, Nov 30, 2012 at 5:43 PM, JJ Allaire <jj.allaire at gmail.com> wrote:

            

  
    
#
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
#
Thanks Dirk; that's the ticket.
On Fri, Nov 30, 2012 at 6:40 PM, Dirk Eddelbuettel <edd at debian.org> wrote: