I’m having the same issues after installing Catalina, and after following @coatless instructions for setting up the tool chain. The issue,
 "Error in sampler$call_sampler(args_list[[i]]) : " " c++ exception (unknown reason)"
occurs after an apparent successful compile of the code and when in the sampling step.
If it helps, re-running the example
post <- stan(...), results in a slightly different error,
Chain 1: empty_nested() must be true before calling recover_memory()
 "Error in sampler$call_sampler(args_list[[i]]) : "
 " empty_nested() must be true before calling recover_memory()"
The error from the example also occurs in my own Stan programs, so probably not unique to the example. Here’s the example in full from the posts above:
blocks <- c(1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7)
df1 <- data.frame(y=output, algorithm=as.integer(categs), block_id=blocks)
post <- stan(model_code = make_stancode(y ~ 1 + (1 | algorithm), data = df1),
data = make_standata(y ~ 1 + (1 | algorithm), data = df1),
verbose = TRUE)
In the r environment, I’m using clang7:
> system("clang++ --version")
clang version 7.0.0 (tags/RELEASE_700/final)
Thread model: posix
# clang: start
# clang: end
CXX14FLAGS=-O3 -march=native -mtune=native
CXX14FLAGS += -arch x86_64 -ftemplate-depth-256
Though I have also tried removing the CXX14 lines above.
My R version is 3.6.1, and rstan (and brms):
> library(rstan); library(brms)
Loading required package: StanHeaders
Loading required package: ggplot2
rstan (Version 2.19.2, GitRev: 2e1f913d3ca3)
For execution on a local, multicore CPU with excess RAM we recommend calling
options(mc.cores = parallel::detectCores()).
To avoid recompilation of unchanged Stan programs, we recommend calling
rstan_options(auto_write = TRUE)
Loading required package: Rcpp
Registered S3 method overwritten by 'xts':
Loading 'brms' package (version 2.10.0). Useful instructions
can be found by typing help('brms'). A more detailed introduction
to the package is available through vignette('brms_overview').
Attaching package: ‘brms’
The following object is masked from ‘package:rstan’:
Here is the verbose dump.txt (61.8 KB) when executing stan() in the example above.