Addressing uuid_t error when compiling with Rcpp 1.0.4 on macOS

At the present time, for R 3.6.3 and Rcpp v1.0.4 there is an issue with the CRAN binaries of Rcpp.

When compiling, you may receive an error message with:

In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:655,
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/gethostuuid.h:39:17: 
error: 'uuid_t' was not declared in this scope; did you mean 'Rcpp::uuid_t'?
   39 | int gethostuuid(uuid_t, const struct timespec *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_NA);
      |                 ^~~~~~
      |                 Rcpp::uuid_t

Solution

The fix is to download and install a patched version of Rcpp from its source at the Rcpp project’s drat repository using:

install.packages("Rcpp", repos="https://rcppcore.github.io/drat")

This only affects macOS users on macOS later than 10.11 (El Capitan).

Why did this occur?

As part of Rcpp v1.0.4, Rcpp’s exception class – Rcpp::exception – was made thread-safe in PR #1043. Unintentionally, the execinfo.h file was placed inside of the Rcpp namespace, rather than globally. Within PR #1047, the inclusion order was fixed with a longer-term solution for support on demangling exceptions raised.

Details of the issue and resolution can be found here:

https://github.com/RcppCore/Rcpp/issues/1060

comments powered by Disqus