Inspite of succeeding with the compilation of R-3.1.2 using the intel suite of compilers ver.2015.0.077 including MKL on my late 2014 MacBook Pro running Yosemite (outlined here), I am unable to install the excellent Rcpp package that I have been thoroughly enjoying thus far via the prepackaged binary R for Mavericks. Now, I would like to speed things up a bit, in particular use OpenMP that is seemingly incompatible with the default clang. I am aware of the OpenMP/clang project but it seems that installation on Yosemite is still dodgy.
Apart from several mentions of Warning in strptime during make -j8, make install completes successfully and I am able to install most packages on the freshly compiled R. The Rcpp package nevertheless fails with:
> install.packages("Rcpp")
Warning in strptime(xx, f <- "%Y-%m-%d %H:%M:%OS", tz = tz) :
unknown timezone 'Asia/Kolkata'
Warning in strptime(xx, f <- "%Y-%m-%d %H:%M:%OS", tz = tz) :
unknown timezone 'GMT'
Warning in strptime(xx, f <- "%Y-%m-%d %H:%M:%OS", tz = tz) :
unknown timezone 'America/New_York'
* installing *source* package ‘Rcpp’ ...
** package ‘Rcpp’ successfully unpacked and MD5 sums checked
Warning in as.POSIXlt.POSIXct(x, tz) : unknown timezone 'GMT'
Warning in as.POSIXlt.POSIXct(x, tz) :
unknown timezone 'America/New_York'
** libs
icpc -I/Users/username/R-3.1.2/include -DNDEBUG -I../inst/include/ -I/sw/include -I/usr/local/include -fPIC -g -O3 -c Date.cpp -o Date.o
In file included from ../inst/include/Rcpp/Vector.h(69),
from ../inst/include/Rcpp.h(38),
from Date.cpp(31):
../inst/include/Rcpp/vector/swap.h(35): error: "swap" is not a class or function template name in the current scope
RCPP_GENERATE_SWAP(generic_proxy,VECSXP)
^
In file included from ../inst/include/Rcpp/Vector.h(69),
from ../inst/include/Rcpp.h(38),
from Date.cpp(31):
../inst/include/Rcpp/vector/swap.h(36): error: "swap" is not a class or function template name in the current scope
RCPP_GENERATE_SWAP(generic_proxy,EXPRSXP)
^
In file included from ../inst/include/Rcpp/Vector.h(69),
from ../inst/include/Rcpp.h(38),
from Date.cpp(31):
../inst/include/Rcpp/vector/swap.h(37): error: "swap" is not a class or function template name in the current scope
RCPP_GENERATE_SWAP(string_proxy,STRSXP)
^
Date.cpp(562): warning #437: reference to local variable of enclosing function is not allowed
2 * sizeof *sp + 4 * TZ_MAX_TIMES];
^
compilation aborted for Date.cpp (code 2)
make: *** [Date.o] Error 2
ERROR: compilation failed for package ‘Rcpp’
Is there a way to fix this? Alternatively, how can I switch compilers to be able to invoke 'OpenMP' via Rcpp on my MacBook?
Here's my best guess at what's going on. In
Rcpp, we provide specializations forstd::swap()here, with relevant bits copied for brevity:It looks like the moment at which your compiler is encountering this header, the appropriate template definition for
std::swap()has not yet been seen, and so it barfs. This seems surprising to me since we do explicitly provide an#include <algorithm>inRcppCommon.h, which is included by default. Alternatively, maybe the headers used by your compiler definestd::swap()in such a way that this form of specialization just doesn't work -- I am not sure.FWIW, cppreference advocates providing these specializations within the namespace wherein the types are defined, rather than
std, to allow for ADL.You might try modifying the Rcpp sources locally to see if you can provide an alternate way of supporting
std::swap()(as suggested bycppreference), and then proposing an upstream modification toRcppas well if all seems well.