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

Dirk Eddelbuettel edd at debian.org
Thu May 29 17:34:46 CEST 2014


Hi Matteo,

On 29 May 2014 at 16:20, Matteo Fasiolo wrote:
| Hi Dirk,
| 
|  adding
| 
| PKG_CPPFLAGS = -DWIN32
| 
| solved the problem,

Good. That fixes my little snafu and gives me a moment to address it.  Maybe
I'll also add the -DWIN32 just to be safe.

| but I got another bunch of errors (see below).
| 
| Maybe these are unsupported C++11 features?
|
| I think I was getting similar errors when I was compiling my package in Linux,
| but they were solved after installing gcc 4.8.

That is precisely it.  

R-on-Windows still defaults to g++ 4.6.* which is older and less featureful.
R knows that, see how you now get  -std=c++0x   from setting the C++11 flag.

And it looks like the Armadillo code wants a newer compiler when C++11 is in
use, which would be a roadblock for you for the time being.  I can discuss
with Conrad whether it is worth covering this aspect at the Armadillo side,
but for now you are between a rock and hard place.

I would recommend looking through the files which come up below, and see if
you can identify additional #ifdef statements.  Armadillo is extremely well
structured and you may find another toggle to suppress the inclusion of
features which tickle the errors below, but which you do not need.  In that
additional -D... definitions may help you.

Keep us posted,  Dirk


| Matteo
| 
| 
| * installing *source* package 'anRpackage' ...
| ** libs
| 
| *** arch - i386
| g++  -std=c++0x -I"D:/RCompile/recent/R-3.1.0/include" -DNDEBUG -DWIN32   -I"d:/RCompile/CRANpkg/lib/3.1/Rcpp/include" -I"d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include" -I"d:/Rcompile/CRANpkg/extralibs215/local215/include"     -O2 -Wall  -mtune=core2 -c RcppExports.cpp -o RcppExports.o
| In file included from d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include/armadillo:48:0,
|                  from d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include/RcppArmadilloForward.h:37,
|                  from d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include/RcppArmadillo.h:30,
|                  from RcppExports.cpp:4:
| d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include/armadillo_bits/compiler_setup.hpp:159:110: note: #pragma message: Your C++ compiler is in C++11 mode, but it has incomplete support for C++11 features
| In file included from d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include/armadillo:172:0,
|                  from d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include/RcppArmadilloForward.h:37,
|                  from d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include/RcppArmadillo.h:30,
|                  from RcppExports.cpp:4:
| d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include/armadillo_bits/wall_clock_bones.hpp:30:5: error: 'steady_clock' in namespace 'std::chrono' does not name a type
| In file included from d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include/armadillo:510:0,
|                  from d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include/RcppArmadilloForward.h:37,
|                  from d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include/RcppArmadillo.h:30,
|                  from RcppExports.cpp:4:
| d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include/armadillo_bits/wall_clock_meat.hpp: In member function 'void arma::wall_clock::tic()':
| d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include/armadillo_bits/wall_clock_meat.hpp:38:5: error: 'chrono_time1' was not declared in this scope
| d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include/armadillo_bits/wall_clock_meat.hpp:38:33: error: 'std::chrono::steady_clock' has not been declared
| d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include/armadillo_bits/wall_clock_meat.hpp: In member function 'double arma::wall_clock::toc()':
| d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include/armadillo_bits/wall_clock_meat.hpp:66:13: error: 'steady_clock' in namespace 'std::chrono' does not name a type
| d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include/armadillo_bits/wall_clock_meat.hpp:70:85: error: 'chrono_time2' was not declared in this scope
| d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include/armadillo_bits/wall_clock_meat.hpp:70:100: error: 'chrono_time1' was not declared in this scope
| make: *** [RcppExports.o] Error 1
| Warning: running command 'make -f "Makevars.win" -f "D:/RCompile/recent/R-3.1.0/etc/i386/Makeconf" -f "D:/RCompile/recent/R-3.1.0/etc/i386/Makevars.site" -f "D:/RCompile/recent/R-3.1.0/share/make/winshlib.mk" CXX='$(CXX1X) $(CXX1XSTD)' CXXFLAGS='$(CXX1XFLAGS)' CXXPICFLAGS='$(CXX1XPICFLAGS)' SHLIB_LDFLAGS='$(SHLIB_CXX1XLDFLAGS)' SHLIB_LD='$(SHLIB_CXX1XLD)' SHLIB="anRpackage.dll" OBJECTS="RcppExports.o rcpparma_hello_world.o"' had status 2
| g++  -std=c++0x -I"D:/RCompile/recent/R-3.1.0/include" -DNDEBUG -DWIN32   -I"d:/RCompile/CRANpkg/lib/3.1/Rcpp/include" -I"d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include" -I"d:/Rcompile/CRANpkg/extralibs215/local215/include"     -O2 -Wall  -mtune=core2 -c RcppExports.cpp -o RcppExports.o
| In file included from d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include/armadillo:48:0,
|                  from d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include/RcppArmadilloForward.h:37,
|                  from d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include/RcppArmadillo.h:30,
|                  from RcppExports.cpp:4:
| d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include/armadillo_bits/compiler_setup.hpp:159:110: note: #pragma message: Your C++ compiler is in C++11 mode, but it has incomplete support for C++11 features
| In file included from d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include/armadillo:172:0,
|                  from d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include/RcppArmadilloForward.h:37,
|                  from d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include/RcppArmadillo.h:30,
|                  from RcppExports.cpp:4:
| d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include/armadillo_bits/wall_clock_bones.hpp:30:5: error: 'steady_clock' in namespace 'std::chrono' does not name a type
| In file included from d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include/armadillo:510:0,
|                  from d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include/RcppArmadilloForward.h:37,
|                  from d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include/RcppArmadillo.h:30,
|                  from RcppExports.cpp:4:
| d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include/armadillo_bits/wall_clock_meat.hpp: In member function 'void arma::wall_clock::tic()':
| d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include/armadillo_bits/wall_clock_meat.hpp:38:5: error: 'chrono_time1' was not declared in this scope
| d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include/armadillo_bits/wall_clock_meat.hpp:38:33: error: 'std::chrono::steady_clock' has not been declared
| d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include/armadillo_bits/wall_clock_meat.hpp: In member function 'double arma::wall_clock::toc()':
| d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include/armadillo_bits/wall_clock_meat.hpp:66:13: error: 'steady_clock' in namespace 'std::chrono' does not name a type
| d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include/armadillo_bits/wall_clock_meat.hpp:70:85: error: 'chrono_time2' was not declared in this scope
| d:/RCompile/CRANpkg/lib/3.1/RcppArmadillo/include/armadillo_bits/wall_clock_meat.hpp:70:100: error: 'chrono_time1' was not declared in this scope
| make: *** [RcppExports.o] Error 1
| Warning: running command 'make -f "Makevars.win" -f "D:/RCompile/recent/R-3.1.0/etc/i386/Makeconf" -f "D:/RCompile/recent/R-3.1.0/etc/i386/Makevars.site" -f "D:/RCompile/recent/R-3.1.0/share/make/winshlib.mk" CXX='$(CXX1X) $(CXX1XSTD)' CXXFLAGS='$(CXX1XFLAGS)' CXXPICFLAGS='$(CXX1XPICFLAGS)' SHLIB_LDFLAGS='$(SHLIB_CXX1XLDFLAGS)' SHLIB_LD='$(SHLIB_CXX1XLD)' SHLIB="anRpackage.dll" OBJECTS="RcppExports.o rcpparma_hello_world.o" symbols.rds' had status 2
| ERROR: compilation failed for package 'anRpackage'
| * removing 'd:/RCompile/CRANguest/R-release/lib/anRpackage'
| * restoring previous 'd:/RCompile/CRANguest/R-release/lib/anRpackage'
| 
| 
| 
| On Thu, May 29, 2014 at 4:15 PM, Dirk Eddelbuettel <edd at debian.org> wrote:
| 
| 
|     Would you mind resending what you just me to the list?
| 
|     Dirk
| 
|     --
|     Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
| 
| 
| _______________________________________________
| Rcpp-devel mailing list
| Rcpp-devel at lists.r-forge.r-project.org
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

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


More information about the Rcpp-devel mailing list