[Rcpp-devel] Specifying compiler to use within Rcpp
Dirk Eddelbuettel
edd at debian.org
Fri May 25 02:33:45 CEST 2012
Hi Nick,
On 24 May 2012 at 16:34, Nick Matzke wrote:
| I've got Mac OS X 10.7, which still uses gcc4.2. I can
| install a separate copy of a newer gcc (e.g. 4.7), but is
| there a way to make Rcpp (and inline) use it while compiling?
|
| I suppose I could use a symbolic link to make gcc refer to
| gcc4.7 everywhere on my system, but that seems like an
| inflexible solution.
That is a generic Unix / R question, not specific to Rcpp. You can either
deal with this system-wide, or just for R. What I do is to modify
~/.R/Makevars
where you set essentially every variable known to R -- see its
$RHOME/etc/Makeconf for inspiration. I include my copy below; you see how I
switch compiler versions and also have a (currently commented-out) portion
for clang/clang++ from llvm. Also note my use of ccache which is very
helpful.
On 24 May 2012 at 19:42, Whit Armstrong wrote:
| For mac specific questions, you should also try here:
| https://stat.ethz.ch/mailman/listinfo/r-sig-mac
Not a Mac-specific question, really, apart from the need to overcome
g++-4.2.1.
| Also, you might want to stick w/ gcc 4.6.
|
| gcc 4.7 is still very new, and I have already seen issues w/ cppbugs
| when -O2 is turned on...
Well, Debian already made it the default compiler in unstable and testing. The
-O3 level created issues for some CRAN packages and for R itself, but
otherwise it seems to work. However, my main dev box is Ubuntu, and there
4.6 is default there so I am fine with that too...
Dirk
~/.R/Makevars below
# edd 03 Mar 2009
## for C code
#CFLAGS= -g -O3 -Wall -pipe -pedantic -std=gnu99 -march=native
#CFLAGS= -O3 -g0 -Wall -pipe -pedantic -std=gnu99 -I/usr/local/cuda/include
CFLAGS= -O3 -g0 -Wall -pipe -pedantic -std=gnu99
## for C++ code
#CXXFLAGS= -g -O3 -Wall -pipe -pedantic -Wno-variadic-macros
#CXXFLAGS= -g0 -O3 -Wall -pipe -pedantic -Wno-variadic-macros
#CXXFLAGS= -std=c++0x -g -O3 -Wall -pipe -pedantic -Wno-variadic-macros
#CXXFLAGS= -g -O3 -Wall -pipe -pedantic -Wno-variadic-macros -DARMA_EXTRA_DEBUG
CXXFLAGS= -g0 -O3 -Wall -pipe -Wno-variadic-macros
#CXXFLAGS= -g -O3 -Wall -pipe -Wno-unused -pedantic
# just a test before RcppArmadillo undef'ed thispp
#PKG_CPPFLAGS= -UNDEBUG
# Kurt:
#CFLAGS = -g -O6 -Wall -Wno-unused -pedantic
#CXXFLAGS = -g -O2 -Wall -Wno-unused -pedantic
## for Fortran code
#FFLAGS=-g -O3 -Wall -pipe
FFLAGS=-O3 -g0 -Wall -pipe
## for Fortran 95 code
#FCFLAGS=-g -O3 -Wall -pipe
FCFLAGS=-O3 -g0 -Wall -pipe
VER=4.6
CC=ccache gcc-$(VER)
CXX=ccache g++-$(VER)
FC=ccache gfortran
F77=ccache gfortran
MAKE=make -j4
#CXX=clang++
#CC=clang
#CXXFLAGS=-Wall -O3
#CFLAGS=-Wall -O3
--
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
More information about the Rcpp-devel
mailing list