[Rcpp-devel] C++11 in Windows R package

Dirk Eddelbuettel edd at debian.org
Mon Jun 9 13:27:48 CEST 2014


On 9 June 2014 at 11:11, Matteo Fasiolo wrote:
| Hi All,
| 
|  I have put the package on CRAN, but I get errors on some platform.

Saw that -- mvnfast looks quite interesting with OpenMP-based RNG!
| 
| In particular, on  r-devel-linux-x86_64-fedora-clang, r-devel-osx-x86_64-clang
| and r-release-osx-x86_64-mavericks I get:
| 
| In file included from rmvnCpp.cpp:20:
| In file included from ./mvnfast.h:4:
| In file included from /data/gannet/ripley/R/test-clang/RcppArmadillo/include/
| RcppArmadillo.h:30:
| In file included from /data/gannet/ripley/R/test-clang/RcppArmadillo/include/
| RcppArmadilloForward.h:37:
| In file included from /data/gannet/ripley/R/test-clang/RcppArmadillo/include/
| armadillo:48:
| /usr/local/include/c++/v1/random:3641:44: error: non-type template argument is
| not a constant expression
|     const size_t __logR = __log2<uint64_t, _URNG::max() - _URNG::min() +
| uint64_t(1)>::value;
| 
| Which I don't know how to interpret, but maybe you do. 

Not quite yet. Some interaction between clang and the RNG.

However, on a (Debian unstable) virtual test instance I created very
recently, I can install it with g++ (4.8.3) and clang-3.5.0-2 (based on LLVM
3.5.0).  Maybe users of different clang versions can chime in?  I can check
later which C++ library this uses.
 
| On the other hand on r-oldrel-windows-ix86+x86_64, I get:
| 
| * installing *source* package 'mvnfast' ...
| ** package 'mvnfast' successfully unpacked and MD5 sums checked
| ** libs
| 
| *** arch - i386
| make[1]: Entering directory `/cygdrive/d/temp/Rtmp8Se4FX/R.INSTALL234440b452a3/
| mvnfast/src-i386'
| g++  -I"D:/Rcompile/recent/R-3.0.3/include" -DNDEBUG    -I"d:/RCompile/CRANpkg/
| lib/3.0/Rcpp/include" -I"d:/RCompile/CRANpkg/lib/3.0/RcppArmadillo/include"
| -I"d:/Rcompile/CRANpkg/extralibs215/local215/include"  -DARMA_DONT_USE_CXX11  
| -O2 -Wall  -mtune=core2 -c dmvnCpp.cpp -o dmvnCpp.o
| In file included from d:\compiler\gcc-4.6.3\bin\../lib/gcc/i686-w64-mingw32/
| 4.6.3/../../../../include/c++/4.6.3/random:35:0,
|                  from mvnfast.h:5,
|                  from dmvnCpp.cpp:20:
| d:\compiler\gcc-4.6.3\bin\../lib/gcc/i686-w64-mingw32/4.6.3/../../../../include
| /c++/4.6.3/bits/c++0x_warning.h:32:2: error: #error This file requires compiler
| and library support for the upcoming ISO C++ standard, C++0x. This support is
| currently experimental, and must be enabled with the -std=c++0x or -std=gnu++0x
| compiler options.
| 
| Could it be that the flag CXX_STD = CXX11 was not supported by this older
| windows release? Can I solve this issue by using Depends R(>= something) in
| Description?

Yes.  For the two (smaller) packages (RcppCNPy, and RcppBDT) where I use
C++11 features I have
      
      Depends: R (>= 3.1.0)

and you should too as C++11 does need R 3.1.0 or later.  

Dirk

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


More information about the Rcpp-devel mailing list