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:
https://discourse.mc-stan.org/t/dealing-with-catalina/11285/195?u=wds15 <https://discourse.mc-stan.org/t/dealing-with-catalina/11285/195?u=wds15> 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: https://discourse.mc-stan.org/t/dealing-with-catalina-ii/11802/42?u=wds15 <https://discourse.mc-stan.org/t/dealing-with-catalina-ii/11802/42?u=wds15> 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. Best, Sebastian [[alternative HTML version deleted]] _______________________________________________ R-SIG-Mac mailing list R-SIG-Mac@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-mac