# \#compiler

**URL:** https://discourse.mc-stan.org/tag/compiler/61.md

[Latest](https://discourse.mc-stan.org/latest.md) · [Categories](https://discourse.mc-stan.org/categories.md) · [Tags](https://discourse.mc-stan.org/tags.md)

---

## [Cmdstanr g++ permission denied](https://discourse.mc-stan.org/t/cmdstanr-g-permission-denied/41805)

<div class="topic-metadata">

**Author:** [@RElahi](https://discourse.mc-stan.org/u/RElahi)\
**Replies:** 12\
**Last updated:** [November 6, 2026, 6:36pm UTC](https://discourse.mc-stan.org/t/cmdstanr-g-permission-denied/41805 "2026-11-06T18:36:35Z")

</div>

My Windows machine recently updated its OS, which seems to have messed up a lot of my R packages. I was able to fix all of them, but now I cannot compile brms models using cmdstanr. I tried reinstalling rstan, cmdstanr, …

---

## [RStan performance differences](https://discourse.mc-stan.org/t/rstan-performance-differences/40684)

<div class="topic-metadata">

**Author:** [@AEman](https://discourse.mc-stan.org/u/AEman)\
**Replies:** 1\
**Last updated:** [December 1, 2025, 11:34am UTC](https://discourse.mc-stan.org/t/rstan-performance-differences/40684 "2025-12-01T11:34:06Z")

</div>

I am switching from one linux HPC system to another. I have noticed a big difference in performance with similar hardware. I was wondering whether it has something to do with compiler flags, could you let me know if it s…

---

## [Trouble building an rstan-dependent package on r-universe](https://discourse.mc-stan.org/t/trouble-building-an-rstan-dependent-package-on-r-universe/40538)

<div class="topic-metadata">

**Author:** [@edm](https://discourse.mc-stan.org/u/edm)\
**Replies:** 5\
**Last updated:** [October 24, 2025, 8:13am UTC](https://discourse.mc-stan.org/t/trouble-building-an-rstan-dependent-package-on-r-universe/40538 "2025-10-24T08:13:59Z")

</div>

The R package blavaan depends on rstan and compiles a Stan model at installation. The package passes the CRAN checks and also works locally. But the r-universe builds are failing with a “stan/version.hpp: No such file or…

---

## [Make Build Compiler Error](https://discourse.mc-stan.org/t/make-build-compiler-error/40163)

<div class="topic-metadata">

**Author:** [@e2dodd](https://discourse.mc-stan.org/u/e2dodd)\
**Replies:** 2\
**Last updated:** [August 13, 2025, 3:35pm UTC](https://discourse.mc-stan.org/t/make-build-compiler-error/40163 "2025-08-13T15:35:46Z")

</div>

Hi, I have been trying to install and compile Stan for sometime. I am completely new to the program. Here’s where I have gotten so far: I have installed Rtools43, and two paths to my environment. C:\\rtools43\\usr\\bin …

---

## [Why does this brms-generated model not compile after 15 minutes?](https://discourse.mc-stan.org/t/why-does-this-brms-generated-model-not-compile-after-15-minutes/39799)

<div class="topic-metadata">

**Author:** [@potash](https://discourse.mc-stan.org/u/potash)\
**Replies:** 3\
**Last updated:** [June 27, 2025, 2:54pm UTC](https://discourse.mc-stan.org/t/why-does-this-brms-generated-model-not-compile-after-15-minutes/39799 "2025-06-27T14:54:53Z")

</div>

(Moving this over from a brms issue at @paul.buerkner recommendation) I am trying to fit this multilevel model using brms 2.22.0 and backend cmdstanr 2.36.0: y ~ x\_1 +... x\_K + (x\_1 + ... + x\_K || g1 \* g2) However, w…

---

## [Extracting Factor Graphs for Stan Models from stanc](https://discourse.mc-stan.org/t/extracting-factor-graphs-for-stan-models-from-stanc/38718)

<div class="topic-metadata">

**Author:** [@CollinCademartori](https://discourse.mc-stan.org/u/CollinCademartori)\
**Replies:** 4\
**Last updated:** [February 11, 2025, 10:24pm UTC](https://discourse.mc-stan.org/t/extracting-factor-graphs-for-stan-models-from-stanc/38718 "2025-02-11T22:24:43Z")

</div>

I’m wondering if it is possible to get the Stan compiler to output a factor graph for a Stan model. From some previous posts in 2019 and 2021, it seems like the computation of the factor graph was implemented in stanc t…

---

## [Cannot compile Rstan Code on Mac M1 and cannot instan cmdstan](https://discourse.mc-stan.org/t/cannot-compile-rstan-code-on-mac-m1-and-cannot-instan-cmdstan/37595)

<div class="topic-metadata">

**Author:** [@aeich](https://discourse.mc-stan.org/u/aeich)\
**Replies:** 1\
**Last updated:** [December 12, 2024, 12:13am UTC](https://discourse.mc-stan.org/t/cannot-compile-rstan-code-on-mac-m1-and-cannot-instan-cmdstan/37595 "2024-12-12T00:13:54Z")

</div>

I have problems running STAN code on a Mac M1. Previously, everything worked as expected but then I needed to install llvm with brew to compile some other packages from source (I think that’s the cause of the problem). N…

---

## [Rstan::expose\_stan\_function on R4.4.0 / Rstan2.32.6 / rcpp 1.0.13](https://discourse.mc-stan.org/t/rstan-expose-stan-function-on-r4-4-0-rstan2-32-6-rcpp-1-0-13/37237)

<div class="topic-metadata">

**Author:** [@notastudent](https://discourse.mc-stan.org/u/notastudent)\
**Replies:** 1\
**Last updated:** [November 14, 2024, 8:35pm UTC](https://discourse.mc-stan.org/t/rstan-expose-stan-function-on-r4-4-0-rstan2-32-6-rcpp-1-0-13/37237 "2024-11-14T20:35:38Z")

</div>

expose\_stan\_function ends up with message: Error in expose\_stan\_functions("NormRNG.stan", show\_compiler\_warnings = T) : Compilation failed! stan file “NormRNG.stan” // This Stan defines a random normal number gener…

---

## [Unable to compile stan file on server](https://discourse.mc-stan.org/t/unable-to-compile-stan-file-on-server/34882)

<div class="topic-metadata">

**Author:** [@christineshen](https://discourse.mc-stan.org/u/christineshen)\
**Replies:** 3\
**Last updated:** [April 28, 2024, 2:35am UTC](https://discourse.mc-stan.org/t/unable-to-compile-stan-file-on-server/34882 "2024-04-28T02:35:34Z")

</div>

I have a stan file which compiles fine on my local laptop (Macbook, R 4.3.2, stan 2.32.2). But when I uploaded the stan file to server (I think it’s linux environment, R 4.3.1, stan 2.32.2), I couldn’t compile the file a…

---

## [Rstan error when running stan function](https://discourse.mc-stan.org/t/rstan-error-when-running-stan-function/34086)

<div class="topic-metadata">

**Author:** [@gavin23](https://discourse.mc-stan.org/u/gavin23)\
**Replies:** 2\
**Last updated:** [February 16, 2024, 1:31am UTC](https://discourse.mc-stan.org/t/rstan-error-when-running-stan-function/34086 "2024-02-16T01:31:56Z")

</div>

Hello, I am very new to rstan. I have installed the package “rstan” in my Rstudio. However, whenever I run the function stan() (e.g., fit2=stan(file = here(“kids2.stan”), data = data, chains = 3, iter = 500)), I will be…

---

## [Compiling R](https://discourse.mc-stan.org/t/compiling-r/33801)

<div class="topic-metadata">

**Author:** [@AMMdk](https://discourse.mc-stan.org/u/AMMdk)\
**Replies:** 1\
**Last updated:** [February 6, 2024, 10:46pm UTC](https://discourse.mc-stan.org/t/compiling-r/33801 "2024-02-06T22:46:28Z")

</div>

When I am compiling a model in Rstan from Rstudio it pops up with “Building R package from source requires installation of additional build tools. Do you want to install additional tools now.” It works even if I say No…

---

## [Segfault when using brms + cmdstanr + compile\_model\_methods = TRUE](https://discourse.mc-stan.org/t/segfault-when-using-brms-cmdstanr-compile-model-methods-true/33771)

<div class="topic-metadata">

**Author:** [@Guido\_Biele](https://discourse.mc-stan.org/u/Guido_Biele)\
**Replies:** 2\
**Last updated:** [January 23, 2024, 4:22pm UTC](https://discourse.mc-stan.org/t/segfault-when-using-brms-cmdstanr-compile-model-methods-true/33771 "2024-01-23T16:22:44Z")

</div>

I am trying to make model\_methods in cmdstanr available. This works on Windows, but if I try it on a Linux server and first load brms (2.20.4) and then cmdstanr i get a segfault (see below for the full error message). I…

---

## [Stan compile with Apple Accelerate BLAS / LAPACK?](https://discourse.mc-stan.org/t/stan-compile-with-apple-accelerate-blas-lapack/32164)

<div class="topic-metadata">

**Author:** [@ssp3nc3r](https://discourse.mc-stan.org/u/ssp3nc3r)\
**Replies:** 4\
**Last updated:** [January 19, 2024, 1:31pm UTC](https://discourse.mc-stan.org/t/stan-compile-with-apple-accelerate-blas-lapack/32164 "2024-01-19T13:31:07Z")

</div>

Is there a way to have Stan use Apple’s versions of BLAS / LAPACK in its accelerate framework on their Apple silicon machines? Using BLAS/LAPACK from Eigen discussing using Apple Accelerate on the backend, and Eigen: A…

---

## [Cmdstanpy reduce\_sum doesn't produce executable](https://discourse.mc-stan.org/t/cmdstanpy-reduce-sum-doesnt-produce-executable/33637)

<div class="topic-metadata">

**Author:** [@mathDR](https://discourse.mc-stan.org/u/mathDR)\
**Replies:** 22\
**Last updated:** [January 2, 2024, 3:52pm UTC](https://discourse.mc-stan.org/t/cmdstanpy-reduce-sum-doesnt-produce-executable/33637 "2024-01-02T15:52:12Z")

</div>

Hello all! I am running the cmdstanpy example for within chain parallelization using reduce\_sum. I am doing so as a base case to show the error I am getting for a bespoke model I am building. In short: If I run impo…

---

## [Brms with cmdstanr compilation error when using threads argument](https://discourse.mc-stan.org/t/brms-with-cmdstanr-compilation-error-when-using-threads-argument/33496)

<div class="topic-metadata">

**Author:** [@wittja01](https://discourse.mc-stan.org/u/wittja01)\
**Replies:** 0\
**Last updated:** [December 4, 2023, 3:30pm UTC](https://discourse.mc-stan.org/t/brms-with-cmdstanr-compilation-error-when-using-threads-argument/33496 "2023-12-04T15:30:43Z")

</div>

I’m attempting to speed up model fitting by specifying the “threads” argument in brms. However, when I do so I receive the following error (at least, I think this is the only/relevant error. I find the output from compil…

---

## [Can't compile code using RStan](https://discourse.mc-stan.org/t/cant-compile-code-using-rstan/33121)

<div class="topic-metadata">

**Author:** [@Justin\_Savoie](https://discourse.mc-stan.org/u/Justin_Savoie)\
**Replies:** 8\
**Last updated:** [November 30, 2023, 4:06pm UTC](https://discourse.mc-stan.org/t/cant-compile-code-using-rstan/33121 "2023-11-30T16:06:52Z")

</div>

I updated Mac OS to Sonoma 14.0. I have M1 arm. RStan stopped working. So I deleted R RStudio, installed XCode anew. Installed R, RStudio, Rstan. It all works, except compilation. For example, rstanarm works, so Stan w…

---

## [Compile issue with Rstan on Macbook Pro M1](https://discourse.mc-stan.org/t/compile-issue-with-rstan-on-macbook-pro-m1/33195)

<div class="topic-metadata">

**Author:** [@Tikavdm](https://discourse.mc-stan.org/u/Tikavdm)\
**Replies:** 16\
**Last updated:** [November 22, 2023, 1:58pm UTC](https://discourse.mc-stan.org/t/compile-issue-with-rstan-on-macbook-pro-m1/33195 "2023-11-22T13:58:38Z")

</div>

Good day I have struggling to get my Rstan working again on my M1 Mac, perhaps some updates messed with it. I have followed the instructions on the Getting Started Page from scratch, but when running the example I get …

---

## [Lots of "deprecated" messages when compiling using brms with cmdstanr](https://discourse.mc-stan.org/t/lots-of-deprecated-messages-when-compiling-using-brms-with-cmdstanr/33355)

<div class="topic-metadata">

**Author:** [@Angelo\_D\_Ambrosio](https://discourse.mc-stan.org/u/Angelo_D_Ambrosio)\
**Replies:** 1\
**Last updated:** [November 17, 2023, 4:40pm UTC](https://discourse.mc-stan.org/t/lots-of-deprecated-messages-when-compiling-using-brms-with-cmdstanr/33355 "2023-11-17T16:40:01Z")

</div>

Hello people, I’m getting a lot of message from the compiler using cmdstanr with brms on a Mac M1. It’s few months I don’t use brms and don’t remember having these messages. I’m on MacOs 13.5.1. Nevertheless the model s…

---

## [Deleting brms messages in markdown](https://discourse.mc-stan.org/t/deleting-brms-messages-in-markdown/33245)

<div class="topic-metadata">

**Author:** [@brophyj](https://discourse.mc-stan.org/u/brophyj)\
**Replies:** 1\
**Last updated:** [November 17, 2023, 8:02am UTC](https://discourse.mc-stan.org/t/deleting-brms-messages-in-markdown/33245 "2023-11-17T08:02:32Z")

</div>

When I run the following code in my console, all is well dat \<- data.frame( Status = c("Primary", "Primary", "Secondary","Secondary"), RX = c("B","P","B","P"), Deaths = c(75, 109, 359, 311), #JAMA (primary) =…

---

## [How to suppress compiler warnings from brms with cmdstanr backend?](https://discourse.mc-stan.org/t/how-to-suppress-compiler-warnings-from-brms-with-cmdstanr-backend/33149)

<div class="topic-metadata">

**Author:** [@qdread](https://discourse.mc-stan.org/u/qdread)\
**Replies:** 4\
**Last updated:** [November 9, 2023, 2:37pm UTC](https://discourse.mc-stan.org/t/how-to-suppress-compiler-warnings-from-brms-with-cmdstanr-backend/33149 "2023-11-09T14:37:36Z")

</div>

I recently updated CmdStan (2.33.1), cmdstanr (0.6.1), and brms (dev version from GitHub) on my Windows 10 machine. Now, whenever I compile a model with brms and cmdstanr backend, I get the following compiler warnings: C…

---

## [Pystan3, compiling a model and using with different data](https://discourse.mc-stan.org/t/pystan3-compiling-a-model-and-using-with-different-data/31744)

<div class="topic-metadata">

**Author:** [@dherrera1911](https://discourse.mc-stan.org/u/dherrera1911)\
**Replies:** 4\
**Last updated:** [October 11, 2023, 3:13pm UTC](https://discourse.mc-stan.org/t/pystan3-compiling-a-model-and-using-with-different-data/31744 "2023-10-11T15:13:59Z")

</div>

I have experience using Stan in R, but now I am starting to use Stan through Python. I see that there has been a major update in PyStan3, which is the version I installed. There are two things that are annoying me in sta…

---

## [Compilation error - passes syntax check](https://discourse.mc-stan.org/t/compilation-error-passes-syntax-check/32059)

<div class="topic-metadata">

**Author:** [@twistedVine](https://discourse.mc-stan.org/u/twistedVine)\
**Replies:** 6\
**Last updated:** [July 17, 2023, 4:20pm UTC](https://discourse.mc-stan.org/t/compilation-error-passes-syntax-check/32059 "2023-07-17T16:20:48Z")

</div>

The following function passes syntax check using cmdstanr, but it will not compile: real beta\_PDF(real x, real a, real b) { if(a\<=0 || b\<=0) { print("bad a or b"); …

---

## [Problem installing cmdstan with R4.2 and RTools42](https://discourse.mc-stan.org/t/problem-installing-cmdstan-with-r4-2-and-rtools42/28846)

<div class="topic-metadata">

**Author:** [@Peter.Stewart](https://discourse.mc-stan.org/u/Peter.Stewart)\
**Replies:** 7\
**Last updated:** [July 12, 2023, 7:29am UTC](https://discourse.mc-stan.org/t/problem-installing-cmdstan-with-r4-2-and-rtools42/28846 "2023-07-12T07:29:59Z")

</div>

Hi everyone, I recently updated to R4.2.1 (and RTools42) , and I’m now encountering problems when trying to reinstall cmdstanr. When I tried to install cmdstan using the install\_cmdstan function in cmdstanr, I encounte…

---

## [Brms package in R producing nullptr\_t error with Clang when compiling C++ on macOS Ventura](https://discourse.mc-stan.org/t/brms-package-in-r-producing-nullptr-t-error-with-clang-when-compiling-c-on-macos-ventura/31777)

<div class="topic-metadata">

**Author:** [@truenomad](https://discourse.mc-stan.org/u/truenomad)\
**Replies:** 0\
**Last updated:** [June 18, 2023, 9:45am UTC](https://discourse.mc-stan.org/t/brms-package-in-r-producing-nullptr-t-error-with-clang-when-compiling-c-on-macos-ventura/31777 "2023-06-18T09:45:49Z")

</div>

I’m running a Bayesian ordinal regression model using the brms package in R on a macOS Ventura 13.4 system with arm64 architecture. My Xcode and command line tools version is 14.3.1 and my Clang version is 14.0.3. My co…

---

## [Code compiling error says invalid connection](https://discourse.mc-stan.org/t/code-compiling-error-says-invalid-connection/31504)

<div class="topic-metadata">

**Author:** [@Deval\_Mali](https://discourse.mc-stan.org/u/Deval_Mali)\
**Replies:** 0\
**Last updated:** [May 24, 2023, 11:04pm UTC](https://discourse.mc-stan.org/t/code-compiling-error-says-invalid-connection/31504 "2023-05-24T23:04:33Z")

</div>

Error in compileCode(f, code, language = language, verbose = verbose) : C:\\rtools42\\x86\_64-w64-mingw32.static.posix\\bin/ld.exe: file20d471dd3569.o:file20d471dd3569.cpp:(.text$\_ZN3tbb8internal26task\_scheduler\_observer\_v3…

---

## [Pystan3 Not compiling with conda version of clang on mac os (can't find header files)](https://discourse.mc-stan.org/t/pystan3-not-compiling-with-conda-version-of-clang-on-mac-os-cant-find-header-files/30719)

<div class="topic-metadata">

**Author:** [@chester](https://discourse.mc-stan.org/u/chester)\
**Replies:** 1\
**Last updated:** [March 14, 2023, 12:30pm UTC](https://discourse.mc-stan.org/t/pystan3-not-compiling-with-conda-version-of-clang-on-mac-os-cant-find-header-files/30719 "2023-03-14T12:30:42Z")

</div>

I am trying to run the following simple code to test out my pystan installation: import pystan fit = pystan.StanModel(model\_code="parameters {real theta;} model {theta ~ normal(0,1);}", model\_name="model\_name") I get t…

---

## [Cannot compile with \`STAN\_THREADS=true\` without \`CXXFLAGS += -fsanitize=undefined\`](https://discourse.mc-stan.org/t/cannot-compile-with-stan-threads-true-without-cxxflags-fsanitize-undefined/29857)

<div class="topic-metadata">

**Author:** [@jpferreira](https://discourse.mc-stan.org/u/jpferreira)\
**Replies:** 5\
**Last updated:** [December 22, 2022, 2:44pm UTC](https://discourse.mc-stan.org/t/cannot-compile-with-stan-threads-true-without-cxxflags-fsanitize-undefined/29857 "2022-12-22T14:44:57Z")

</div>

Hello everyone, I’m having a small issue where compiling a Stan model file with STAN\_THREADS=true raises an error if I do not compile it with CXXFLAGS += -fsanitize=undefined. This happens in my model as well as with th…

---

## [Problem compiling STAN program (via brms) on HPC](https://discourse.mc-stan.org/t/problem-compiling-stan-program-via-brms-on-hpc/26189)

<div class="topic-metadata">

**Author:** [@szymekdr](https://discourse.mc-stan.org/u/szymekdr)\
**Replies:** 9\
**Last updated:** [December 17, 2022, 5:48pm UTC](https://discourse.mc-stan.org/t/problem-compiling-stan-program-via-brms-on-hpc/26189 "2022-12-17T17:48:13Z")

</div>

Hi, I’m trying to use brms and RStan on a HPC. The code is not running - the model terminates right after attempting to compile. The below error information comes from the example from RStan package: example(stan\_model,…

---

## [Has anyone successfully compiled and ran the External C++ example with CmdstanPy on a Mac M1?](https://discourse.mc-stan.org/t/has-anyone-successfully-compiled-and-ran-the-external-c-example-with-cmdstanpy-on-a-mac-m1/29682)

<div class="topic-metadata">

**Author:** [@mathDR](https://discourse.mc-stan.org/u/mathDR)\
**Replies:** 3\
**Last updated:** [December 4, 2022, 11:27pm UTC](https://discourse.mc-stan.org/t/has-anyone-successfully-compiled-and-ran-the-external-c-example-with-cmdstanpy-on-a-mac-m1/29682 "2022-12-04T23:27:12Z")

</div>

Hi all. I was wondering if anyone has successfully implemented the External C++ Example within cmdstanpy on an Apple M1 running Monterey (12.6.1). When I try to run it, I cannot compile the model (I posted an issue to …

---

## [Reduce\_sum incompatible types](https://discourse.mc-stan.org/t/reduce-sum-incompatible-types/29434)

<div class="topic-metadata">

**Author:** [@acraevschi](https://discourse.mc-stan.org/u/acraevschi)\
**Replies:** 1\
**Last updated:** [November 10, 2022, 6:03pm UTC](https://discourse.mc-stan.org/t/reduce-sum-incompatible-types/29434 "2022-11-10T18:03:36Z")

</div>

Hello! I am trying to re-write a model that I have using reduced\_sum to parallelize chains but unfortunately I cannot get cmdstan to compile the model. The error, according to error messages, should be somewhere in type…

[Next page](https://discourse.mc-stan.org/tag/compiler/61.md?match_all_tags=true&page=1&tags%5B%5D=compiler)
