[Rcpp-devel] R CMD check not happy about -std=c++0x
Romain François
francoisromain at free.fr
Fri Jan 15 14:26:03 CET 2010
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".
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.
PKG_LIBS=`Rcpp:::LdFlags()`
# this tricks R CMD SHLIB so that it does not compile
# anything
OBJECTS=
all: compile link
compile:
$(CXX) $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) $(RCPP_CXXFLAGS) .....
link:
$(SHLIB_CXXLD) -o $(pkg)$(DYLIB_EXT) $^ $(SHLIB_CXXLDFLAGS) $(PKG_LIBS)
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.
Romain
> 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://romainfrancois.blog.free.fr
|- 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
More information about the Rcpp-devel
mailing list