0

I'm attempting to compile an R package using the Rcpp11 bindings to use a C++11 binary under the hood. I have successfully compiled and used this package on my Mac (OSX 10.9.5, the compiler is clang++):

Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn) Target: x86_64-apple-darwin13.4.0 Thread model: posix

However, an attempt to compile under 64-bit Red Hat Linux with the g++ compiler version 4.4.7-4 fails because the header or library or namespace called future cannot be found:

In file included from RcppExports.cpp:4: /path/to/R-libs/3.1/Rcpp11/include/Rcpp.h:50:18: error: future: No such file or directory

As far as I know, future is part of the C++11 specification. I find it odd that several other namespaces are successfully loaded (we successfully make it to the 50th line of Rcpp.h), but future doesn't. Is this due to using an outdated compiler? For reference, I'll attach the actual call to the g++ compiler that fails:

g++ -m64 -std=c++0x -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/path/to/R-libs/3.1/Rcpp11/include" -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c RcppExports.cpp -o RcppExports.o

Wesley
  • 1,324
  • 1
  • 11
  • 27
  • 3
    Yes, g++ 4.4.* is (way) too old for any meaningful C++11 work, and it won't matter which Rcpp* variant you use as the constraint comes from the C++11 side. With an old Rd Hat box you will have difficulties no matter what. – Dirk Eddelbuettel Oct 20 '14 at 19:08
  • Technically, 4.4.7 isn't that old, but of course 4.4.0 was released on April 19th 2009, so the main release is a bit over 5 years old by now. It was released on March 13th 2012. gcc 4.7.0 is the first to fully support C++11, which was released on the Marth 22nd 2012. But as RedHat are conservative with new versions, picking a 4.7.0 release over a 4.4.7 is probably a bit risky, as things are likely to change between 4.4 and 4.5, never mind 4.4 to 4.7. I personally would get 4.8.2 or 4.9.1, build that locally and go for it. – Mats Petersson Oct 20 '14 at 19:21
  • Thanks, guys. Sadly, this Red Hat box is my department's high performance server, and I don't have root access to install a newer compiler. Sigh. – Wesley Oct 20 '14 at 19:47

1 Answers1

2

When Rcpp11 does not compile, it usually means that the compiler is not a C++11 compiler. Previous versions of Rcpp11 used some compromise on what C++11 means, but the next versions won't compromise. C++11 = C++11, not unfinished C++0x.

What makes C++11 and forward great is how all these pieces fit together.

Having a C++11 compiler is the price to pay to use Rcpp11. I see this as a feature.

Romain Francois
  • 17,432
  • 3
  • 51
  • 77