[Rcpp-devel] R CMD check not happy about -std=c++0x
edd at debian.org
Fri Jan 15 21:55:46 CET 2010
On 15 January 2010 at 14:26, Romain François wrote:
| On 01/15/2010 02:15 PM, Dirk Eddelbuettel wrote:
| > On 15 January 2010 at 08:27, Romain François wrote:
| > | I'm getting a warning when I try to build my CPP package that depends on
| > | Rcpp and uses the classic Makevars :
| > |
| > | PKG_CXXFLAGS=`Rcpp:::CxxFlags()` -I.
| > | PKG_LIBS=`Rcpp:::LdFlags()`
| > |
| > |
| > | I get this warning from R CMD check :
| > |
| > | * checking for portable compilation flags in Makevars ... WARNING
| > | Non-portable flags in variable 'PKG_CXXFLAGS':
| > | -std=c++0x
| > I also noticed that yesterday working on another package using Rcpp. I think
| > we need to fix this.
| Rcpp:::CxxFlags() will only include "-std=c++0x" when we know we can use
| it : GCC >= 4.3
| but there is no way to tell R CMD that "this is alright, go on".
It is tricky. I think there are 'two GCCs' here, if not three:
a) when we build Rcpp we can query what compiler it sees; that is how we
started -- but there is the rub: the compiler that 'g++ --version' shows
may not be the one that is used to build the package!!
That we learn via R CMD config CXX and I think I adjusted configure
So this govern how Rcpp is built.
b) But here is the sticky bit. Rcpp is used by other packages, and we no
longer control what compiler they use !!
In that sense I fear that your tests of 'can use C++0x' may be too
optimistic and I am wondering if we should make it a simple user control,
just like the one for static links.
Simple because we don't know how we may be called.
Does this make sense to you?
| We can subvert the test if we explicitely define how to compile and
| link, i.e something like this (although it does not work)
| RCPP_CXXFLAGS=`Rcpp:::CxxFlags()` -I.
| # this tricks R CMD SHLIB so that it does not compile
| # anything
| all: compile link
| $(CXX) $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) $(RCPP_CXXFLAGS) .....
| $(SHLIB_CXXLD) -o $(pkg)$(DYLIB_EXT) $^ $(SHLIB_CXXLDFLAGS) $(PKG_LIBS)
I don't follow. Who now sets which flags differently?
| I've played with this, but since I don't understand Makefile, this does
| not work. Someone with makefile skills would make sense of it I suppose.
| Too dumb here.
| > Recall that 'can use Cxx0x' should be based on the compiler used to build R
| > (!!) not Rcpp or the current package. So we need to query 'R CMD config CXX'
| > at build time and somehow remember that.
| > | Is there a workaround ? We probably would then have to update the new
| > | skeleton generator to use it.
| > Right.
| Romain Francois
| Professional R Enthusiast
| +33(0) 6 28 91 30 30
| |- http://tr.im/KfKn : Rcpp 0.7.2
| |- http://tr.im/JOlc : External pointers with Rcpp
| `- http://tr.im/JFqa : R Journal, Volume 1/2, December 2009
| Rcpp-devel mailing list
| Rcpp-devel at lists.r-forge.r-project.org
Three out of two people have difficulties with fractions.
More information about the Rcpp-devel