[R-SIG-Mac] macOS Catalina problems due to C++ ABI changes
@dw@po@t @end|ng |rom w@eber@@de
Sun Nov 10 18:59:34 CET 2019
Dear Mac / R users,
the Stan project has currently some major issues with bringing RStan to work smoothly under macOS Catalina. RStan requires compilation of Stan models in C++ und makes heavy use of C++ exceptions. The handling of C++ exceptions seems to have bugs whenever macOS Catalina libc++ libraries are mixed with those distributed with R binaries which are in use with the recommended clang7 for R 3.6.1. An example code based on Rcpp to illustrate the issue with the exception is found here:
The throw_exception() function is expected to display under R „this is an exception“, but the buggy behavior leads to a message of „unkown exception“.
The example does work fine if R is installed under macOS and all packages are installed from source (and the XCode clang is used). In that case the exceptions work fine. Oddly, if you load just a single R package like readr, which involves C++ code and is installed as binary from CRAN, then the faulty behavior occurs again.
After some debugging of the problem there appears to be a solution to the problem on macOS Catalina. A solution is posted here:
In short, the described problems can be avoided by using the C++ libraries from clang only OR by avoiding the use of the libc++abi.1.dylib of the macOS system and instead using the ABI of the R libraries.
To me this sounds as if there was an ABI change in the distributed macOS Catalina C++ libraries. This would be very problematic with anything where a R package links against a system installed tool.
Maybe this should be considered in the binary packages of R for macOS, but I am not sure what is best here (it looks to me like a bug in Apples ABI). In any case, I do think that this problem needs consideration for future Mac binary packages distributed by CRAN.
[[alternative HTML version deleted]]
More information about the R-SIG-Mac