# Error in brms compiling

**URL:** <https://discourse.mc-stan.org/t/error-in-brms-compiling/16578>\
**Category:** brms\
**Tags:** rstan\
**Created:** [July 13, 2020, 6:27pm UTC](https://discourse.mc-stan.org/t/error-in-brms-compiling/16578 "2020-07-13T18:27:49Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Canaan\_Breiss](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/canaan_breiss/32/6694_2.png) [@Canaan\_Breiss](https://discourse.mc-stan.org/u/Canaan_Breiss)\
**Post date:** [July 13, 2020, 6:27pm UTC](https://discourse.mc-stan.org/t/error-in-brms-compiling/16578/1 "2020-07-13T18:27:49Z")

</div>

Hi,

I’m trying to fit a brms model that previously worked fine, and get the warning

> “Compiling Stan program…  
> The NEXT version of Stan will not be able to pre-process your Stan program.  
> Please open an issue at  
> [Issues · stan-dev/stanc3 · GitHub](https://github.com/stan-dev/stanc3/issues)  
> if you can share or at least describe your Stan program. This will help ensure that Stan  
> continues to work on your Stan programs in the future. Thank you!  
> This message can be avoided by wrapping your function call inside suppressMessages().  
> cannot remove file ‘C:\Users\canaa\AppData\Local\Temp\RtmpgtGlUo\file962869932f4d.stan’, reason ‘No such file or directory’”

I can’t locate the specific temporary file, and have uninstalled and reinstalled r, rstudio, and rtools to the latest version. I’m on Windows 10 x64. The function then halts and throws this warning:

> Error in compileCode(f, code, language = language, verbose = verbose) : Compilation ERROR, function(s)/method(s) not created! C:/rtools40/mingw64/bin/…/lib/gcc/x86\_64-w64-mingw32/8.3.0/…/…/…/…/x86\_64-w64-mingw32/bin/ld.exe: file96286eb28c9.o:file96286eb28c9.cpp:(.text+0xe4c): undefined reference to `tbb::internal::task_scheduler_observer_v3::observe(bool)' C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: file96286eb28c9.o:file96286eb28c9.cpp:(.text+0x2787): undefined reference to `rstan::stan\_fit::stan\_fit(SEXPREC\*, int)’ C:/rtools40/mingw64/bin/…/lib/gcc/x86\_64-w64-mingw32/8.3.0/…/…/…/…/x86\_64-w64-mingw32/bin/ld.exe: file96286eb28c9.o:file96286eb28c9.cpp:(.text+0xe8e): undefined reference to `tbb::internal::task\_scheduler\_observer\_v3::observe(bool)’ C:/rtools40/mingw64/bin/…/lib/gcc/x86\_64-w64-mingw32/8.3.0/…/…/…/…/x86\_64-w64-mingw32/bin/ld.exe: file96286eb28c9.o:file96286eb28c9.cpp:(.text$\_ZN3tbb8internal26task\_scheduler\_observer\_v3D1Ev[\_ZN3tbb8internal26task\_scheduler\_observe

Any suggestions?

---

<div class="post-metadata">

**Author:** ![Michael\_Thompson](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/michael_thompson/32/4691_2.png) [@Michael\_Thompson](https://discourse.mc-stan.org/u/Michael_Thompson)\
**Post date:** [July 14, 2020, 2:41am UTC](https://discourse.mc-stan.org/t/error-in-brms-compiling/16578/2 "2020-07-14T02:41:21Z")

</div>

Today I updated R to v.4.0.2, udated all packages, too. Now I’m getting almost identical errors as Canaan\_Breiss whether I run the models directly in rstan as Stan programs or through brms. I get the following message when running one of Stan’s stan\_demo() models:

The NEXT version of Stan will not be able to pre-process your Stan program.  
Please open an issue at  
[https://github.com/stan-dev/stanc3/issues](https://github.com/stan-dev/stanc3/issues)  
if you can share or at least describe your Stan program. This will help ensure that Stan  
continues to work on your Stan programs in the future. Thank you!  
This message can be avoided by wrapping your function call inside suppressMessages().  
Error in compileCode(f, code, language = language, verbose = verbose) :  
Compilation ERROR, function(s)/method(s) not created! C:/rtools40/mingw64/bin/…/lib/gcc/x86\_64-w64-mingw32/8.3.0/…/…/…/…/x86\_64-w64-mingw32/bin/ld.exe: file215c36107370.o:file215c36107370.cpp:(.text+0x134c): undefined reference to `rstan::stan\_fit::stan\_fit(SEXPREC\*, int)’  
\<\<…and so on…\>\>

---

<div class="post-metadata">

**Author:** ![torkar](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/torkar/32/1355_2.png) [@torkar](https://discourse.mc-stan.org/u/torkar)\
**Post date:** [July 14, 2020, 6:23am UTC](https://discourse.mc-stan.org/t/error-in-brms-compiling/16578/3 "2020-07-14T06:23:15Z")

</div>

This might help?

> [@Error compiling/running model in Rstan in Mac OSX Catalina](https://discourse.mc-stan.org/t/error-compiling-running-model-in-rstan-in-mac-osx-catalina/16535/8):
>
> I believe those messages will go away if you temporarily do remotes::install\_github("stan-dev/rstan", ref = "develop", subdir = "rstan/rstan")

---

<div class="post-metadata">

**Author:** ![Canaan\_Breiss](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/canaan_breiss/32/6694_2.png) [@Canaan\_Breiss](https://discourse.mc-stan.org/u/Canaan_Breiss)\
**Post date:** [July 14, 2020, 7:21am UTC](https://discourse.mc-stan.org/t/error-in-brms-compiling/16578/4 "2020-07-14T07:21:36Z")

</div>

Tried this, got errors:

Downloading GitHub repo stan-dev/rstan@develop  
stan-dev-rstan-a9b5554/StanHeaders/inst/include/libsundials: Can’t create ‘\\?\C:\Users\canaa\AppData\Local\Temp\RtmpqQj6gu\remotes6d30164d62a5\stan-dev-rstan-a9b5554\StanHeaders\inst\include\libsundials’  
stan-dev-rstan-a9b5554/StanHeaders/inst/include/src: Can’t create ‘\\?\C:\Users\canaa\AppData\Local\Temp\RtmpqQj6gu\remotes6d30164d62a5\stan-dev-rstan-a9b5554\StanHeaders\inst\include\src’  
stan-dev-rstan-a9b5554/StanHeaders/inst/include/stan: Can’t create ‘\\?\C:\Users\canaa\AppData\Local\Temp\RtmpqQj6gu\remotes6d30164d62a5\stan-dev-rstan-a9b5554\StanHeaders\inst\include\stan’  
tar.exe: Error exit delayed from previous errors.  
“C:\PROGRA~1\Git\cmd\git.exe” clone --depth 1 --no-hardlinks --recurse-submodules --branch develop [https://github.com/stan-dev/stan.git](https://github.com/stan-dev/stan.git) C:\Users\canaa\AppData\Local\Temp\RtmpqQj6gu\remotes6d30164d62a5/stan-dev-rstan-a9b5554/rstan/rstan/…/…/StanHeaders/inst/include/upstream  
Error: Failed to install ‘rstan’ from GitHub:  
Command failed (128)  
In addition: Warning messages:  
1: In utils::untar(tarfile, …) :  
‘tar.exe -xf “C:\Users\canaa\AppData\Local\Temp\RtmpqQj6gu\file6d309a57024.tar.gz” -C “C:/Users/canaa/AppData/Local/Temp/RtmpqQj6gu/remotes6d30164d62a5”’ returned error code 1  
2: In system(full, intern = TRUE, ignore.stderr = quiet) :  
running command ‘“C:\PROGRA~1\Git\cmd\git.exe” clone --depth 1 --no-hardlinks --recurse-submodules --branch develop [https://github.com/stan-dev/stan.git](https://github.com/stan-dev/stan.git) C:\Users\canaa\AppData\Local\Temp\RtmpqQj6gu\remotes6d30164d62a5/stan-dev-rstan-a9b5554/rstan/rstan/…/…/StanHeaders/inst/include/upstream’ had status 128

Unsure what else to try?

---

<div class="post-metadata">

**Author:** ![torkar](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/torkar/32/1355_2.png) [@torkar](https://discourse.mc-stan.org/u/torkar)\
**Post date:** [July 14, 2020, 7:52am UTC](https://discourse.mc-stan.org/t/error-in-brms-compiling/16578/5 "2020-07-14T07:52:06Z")

</div>

This looks very strange…

> [@Canaan\_Breiss](#):
>
> ‘\?\C:\Users\

Let’s see if someone with Windows can decipher this :) @bgoodri might be the one

---

<div class="post-metadata">

**Author:** ![giucarny](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/giucarny/32/8684_2.png) [@giucarny](https://discourse.mc-stan.org/u/giucarny)\
**Post date:** [July 15, 2020, 5:56am UTC](https://discourse.mc-stan.org/t/error-in-brms-compiling/16578/6 "2020-07-15T05:56:26Z")

</div>

Hi there,

Today I installed the latest versions of R, Rstudio, and Rtools on a Windows 10 x64 machine, and I downloaded the latest version of `brms` and `rstan`. I tried to run several models with the `brm()` function but unfortunately I have not been able to obtain any result.

For instance:

```
> set.seed(112358)
> 
> db <- data.frame(grp=rbinom(n=2000,size=1, prob=.5),
+ xcont=rnorm(n=2000, mean=0, sd=2),
+ xcat=factor(rbinom(n=2000, size=4, prob=.24)),
+ y=rbinom(n=2000, size=10, prob=.5))
> 
> fit <- brm(y ~ xcat + xcont +
+ (1 | grp),
+ data=db,
+ chains= 1,
+ iter = 4000,
+ warmup = 1000,
+ seed = 112358)
Compiling Stan program...

```

Then, after few seconds, it stops without returning any error or warning message, and of course any object.

Furthermore, I followed the steps above and I am getting the same errors of Canaan\_Breiss and Michael\_Thompson.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Robert\_Suchting](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/robert_suchting/32/6732_2.png) [@Robert\_Suchting](https://discourse.mc-stan.org/u/Robert_Suchting)\
**Post date:** [July 17, 2020, 9:10pm UTC](https://discourse.mc-stan.org/t/error-in-brms-compiling/16578/7 "2020-07-17T21:10:18Z")

</div>

I was having this same exact problem until I rolled Stan back to version 2.19.3, as suggested by Dr. Bürkner on another thread: [Potential Problems with rstan and /or brms packages in R 4.0.2](https://discourse.mc-stan.org/t/potential-problems-with-rstan-and-or-brms-packages-in-r-4-0-2/16479/8)

---

<div class="post-metadata">

**Author:** ![dgomes](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/dgomes/32/10874_2.png) [@dgomes](https://discourse.mc-stan.org/u/dgomes)\
**Post date:** [March 7, 2021, 2:33am UTC](https://discourse.mc-stan.org/t/error-in-brms-compiling/16578/8 "2021-03-07T02:33:01Z")

</div>

Hi all, I am getting a similar error as the OP with a `brms::brm` model:

```
Compiling Stan program...
Error in compileCode(f, code, language = language, verbose = verbose) : 
  Compilation ERROR, function(s)/method(s) not created! C:/Program Files/R/R-4.0.4/library/rstan/lib/x64/libStanServices.a(stan_fit.o): duplicate section `.rdata$_ZTIN5boost10wrapexceptISt12domain_errorEE[_ZTIN5boost10wrapexceptISt12domain_errorEE]' has different size
C:/Program Files/R/R-4.0.4/library/rstan/lib/x64/libStanServices.a(stan_fit.o): duplicate section `.rdata$_ZTIN5boost10wrapexceptISt14overflow_errorEE[_ZTIN5boost10wrapexceptISt14overflow_errorEE]' has different size
C:/Program Files/R/R-4.0.4/library/rstan/lib/x64/libStanServices.a(stan_fit.o): duplicate section `.rdata$_ZTIN5boost10wrapexceptISt11logic_errorEE[_ZTIN5boost10wrapexceptISt11logic_errorEE]' has different size
C:/Program Files/R/R-4.0.4/library/rstan/lib/x64/libStanServices.a(stan_fit.o): duplicate section `.rdata$_ZTIN5boost10wrapexceptINS_4math16evaluation_errorEEE[_ZTIN5boost10wrapexceptINS_4math16evaluation_errorEEE]' has different size
C:/Program Files/R/R-4.0.4/library/rstan/lib/x64/libStanServ
In addition: Warning message:
In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
  '-E' not found
Error in sink(type = "output") : invalid connection

```

I was having similar errors with R version 4.0.2, so I updated R, and everything else:

```
sessionInfo()
R version 4.0.4 (2021-02-15)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats graphics grDevices utils datasets methods base     

other attached packages:
 [1] rstan_2.21.2 ggplot2_3.3.3 StanHeaders_2.21.0-7 brms_2.14.4         
 [5] Rcpp_1.0.5 MCMCglmm_2.30 coda_0.19-4 Matrix_1.3-2        
 [9] geiger_2.0.7 ape_5.4             

loaded via a namespace (and not attached):
  [1] cubature_2.0.4.1 minqa_1.2.4 colorspace_1.4-1       
  [4] ellipsis_0.3.1 ggridges_0.5.3 rsconnect_0.8.16       
  [7] estimability_1.3 corpcor_1.6.9 markdown_1.1           
 [10] base64enc_0.1-3 rstudioapi_0.13 DT_0.17                
 [13] fansi_0.4.1 mvtnorm_1.1-1 codetools_0.2-18       
 [16] bridgesampling_1.0-0 splines_4.0.4 mnormt_2.0.1           
 [19] knitr_1.31 shinythemes_1.2.0 bayesplot_1.8.0        
 [22] projpred_2.0.2 jsonlite_1.7.2 nloptr_1.2.2.2         
 [25] shiny_1.6.0 compiler_4.0.4 emmeans_1.5.4          
 [28] backports_1.1.7 assertthat_0.2.1 fastmap_1.0.1          
 [31] cli_2.3.1 later_1.1.0.1 prettyunits_1.1.1      
 [34] htmltools_0.5.1.1 tools_4.0.4 igraph_1.2.5           
 [37] gtable_0.3.0 glue_1.4.1 reshape2_1.4.4         
 [40] clusterGeneration_1.3.7 dplyr_1.0.2 maps_3.3.0             
 [43] V8_3.2.0 fastmatch_1.1-0 vctrs_0.3.2            
 [46] nlme_3.1-152 crosstalk_1.1.1 tensorA_0.36.2         
 [49] xfun_0.15 stringr_1.4.0 ps_1.3.3               
 [52] lme4_1.1-23 mime_0.9 miniUI_0.1.1.1         
 [55] lifecycle_1.0.0 phangorn_2.5.5 gtools_3.8.2           
 [58] statmod_1.4.34 MASS_7.3-53 zoo_1.8-8              
 [61] scales_1.1.1 subplex_1.6 colourpicker_1.1.0     
 [64] promises_1.1.1 Brobdingnag_1.2-6 parallel_4.0.4         
 [67] inline_0.3.17 expm_0.999-5 shinystan_2.5.0        
 [70] animation_2.6 curl_4.3 gamm4_0.2-6            
 [73] yaml_2.2.1 gridExtra_2.3 loo_2.4.1              
 [76] stringi_1.4.6 dygraphs_1.1.1.6 plotrix_3.8-1          
 [79] phytools_0.7-70 boot_1.3-27 pkgbuild_1.2.0         
 [82] rlang_0.4.7 pkgconfig_2.0.3 matrixStats_0.56.0     
 [85] evaluate_0.14 lattice_0.20-41 purrr_0.3.4            
 [88] rstantools_2.1.1 htmlwidgets_1.5.3 processx_3.4.5         
 [91] tidyselect_1.1.0 deSolve_1.28 plyr_1.8.6             
 [94] magrittr_2.0.1 R6_2.5.0 generics_0.1.0         
 [97] combinat_0.0-8 withr_2.4.1 pillar_1.4.6           
[100] mgcv_1.8-33 xts_0.12-0 scatterplot3d_0.3-41   
[103] abind_1.4-5 tibble_3.0.3 crayon_1.4.1           
[106] tmvnsim_1.0-2 rmarkdown_2.7 grid_4.0.4             
[109] callr_3.5.1 threejs_0.3.3 digest_0.6.25          
[112] xtable_1.8-4 httpuv_1.5.4 numDeriv_2016.8-1.1    
[115] RcppParallel_5.0.2 stats4_4.0.4 munsell_0.5.0          
[118] quadprog_1.5-8 shinyjs_2.0.0         

```

I have tried to look into the file that the error is referencing (libStanServices.a) to look for something that might be duplicated, but I am not familiar with the format. Also not sure if it is helpful, but Stan compiles from `rstanarm` without any issues. Any ideas?

---

<div class="post-metadata">

**Author:** ![andrjohns](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/andrjohns/32/15297_2.png) [@andrjohns](https://discourse.mc-stan.org/u/andrjohns)\
**Post date:** [March 7, 2021, 7:45am UTC](https://discourse.mc-stan.org/t/error-in-brms-compiling/16578/9 "2021-03-07T07:45:01Z")

</div>

What output do you get from the RStan example model:

```
example(stan_model,package="rstan",run.dontrun=T)

```

---

<div class="post-metadata">

**Author:** ![dgomes](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/dgomes/32/10874_2.png) [@dgomes](https://discourse.mc-stan.org/u/dgomes)\
**Post date:** [March 7, 2021, 6:10pm UTC](https://discourse.mc-stan.org/t/error-in-brms-compiling/16578/10 "2021-03-07T18:10:34Z")

</div>

The output the first time I ran it was much larger than the space in the console, but the second time was much shorter and manageable… not sure why. The output is attached.

[stan\_model.txt](https://discourse.mc-stan.org/uploads/short-url/ntIYRL9LlfHp7meskVE1YwXBKEs.txt) (8.8 KB)

---

<div class="post-metadata">

**Author:** ![andrjohns](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/andrjohns/32/15297_2.png) [@andrjohns](https://discourse.mc-stan.org/u/andrjohns)\
**Post date:** [March 7, 2021, 6:20pm UTC](https://discourse.mc-stan.org/t/error-in-brms-compiling/16578/11 "2021-03-07T18:20:35Z")

</div>

There aren’t any errors in that output, it looks like everything ran and sampled fine?

---

<div class="post-metadata">

**Author:** ![dgomes](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/dgomes/32/10874_2.png) [@dgomes](https://discourse.mc-stan.org/u/dgomes)\
**Post date:** [March 7, 2021, 6:26pm UTC](https://discourse.mc-stan.org/t/error-in-brms-compiling/16578/12 "2021-03-07T18:26:21Z")

</div>

No errors, just the warning  
`Warning message: In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) : '-E' not found`  
Stan seems to compile fine from `rstanarm` as well, but not for `brms`.

---

<div class="post-metadata">

**Author:** ![andrjohns](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/andrjohns/32/15297_2.png) [@andrjohns](https://discourse.mc-stan.org/u/andrjohns)\
**Post date:** [March 7, 2021, 6:28pm UTC](https://discourse.mc-stan.org/t/error-in-brms-compiling/16578/13 "2021-03-07T18:28:32Z")

</div>

That’s because there’s actually no compiling in `rstanarm`.

Can you try restarting R, and reinstalling RcppParallel, rstan, and StanHeaders from source?

Make sure that rstan isn’t loaded, otherwise that’ll cause issues

---

<div class="post-metadata">

**Author:** ![dgomes](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/dgomes/32/10874_2.png) [@dgomes](https://discourse.mc-stan.org/u/dgomes)\
**Post date:** [March 7, 2021, 7:32pm UTC](https://discourse.mc-stan.org/t/error-in-brms-compiling/16578/14 "2021-03-07T19:32:30Z")

</div>

I apologize for the naivety - I get an error, but perhaps I am missing a step. When I just add `type="source"` to `install.packages` (see below), R can’t find ggplot2 or rstan.

However answers to this question ([How do I install an R package from source? - Stack Overflow](https://stackoverflow.com/questions/1474081/how-do-i-install-an-r-package-from-source)) suggest adding paths to the package or a url. In my ~/library/rstan directory, I do not see any .gz or .tar files (like answers to that post are suggesting), and I am unsure what exactly I should be referencing from ([GitHub - stan-dev/rstan: RStan, the R interface to Stan](https://github.com/stan-dev/rstan)) in a url.

```
install.packages(c("RcppParallel", "rstan", "StanHeaders"), type = "source")
Error in install.packages : Updating loaded packages
Loading required package: rstan
Loading required package: ggplot2
Error: package or namespace load failed for ‘ggplot2’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
 namespace ‘rlang’ 0.4.7 is already loaded, but >= 0.4.10 is required
Failed with error: ‘package ‘ggplot2’ could not be loaded’
Error in .requirePackage(package) : 
  unable to find required package ‘rstan’
Loading required package: rstan
Loading required package: ggplot2
Error: package or namespace load failed for ‘ggplot2’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
 namespace ‘rlang’ 0.4.7 is already loaded, but >= 0.4.10 is required
Failed with error: ‘package ‘ggplot2’ could not be loaded’
Error in .requirePackage(package) : 
  unable to find required package ‘rstan’
Loading required package: rstan
Loading required package: ggplot2
Error: package or namespace load failed for ‘ggplot2’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
 namespace ‘rlang’ 0.4.7 is already loaded, but >= 0.4.10 is required
Failed with error: ‘package ‘ggplot2’ could not be loaded’
Error in .requirePackage(package) : 
  unable to find required package ‘rstan’
```

---

<div class="post-metadata">

**Author:** ![andrjohns](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/andrjohns/32/15297_2.png) [@andrjohns](https://discourse.mc-stan.org/u/andrjohns)\
**Post date:** [March 8, 2021, 12:30am UTC](https://discourse.mc-stan.org/t/error-in-brms-compiling/16578/15 "2021-03-08T00:30:58Z")

</div>

Can you close and re-open R/RStudio, making sure that no packages are loaded, and run:

```
# Remove old packages
remove.packages(c("rstan","StanHeaders","RcppParallel"))

# Compile packages using all cores
Sys.setenv(MAKEFLAGS = paste0("-j",parallel::detectCores()))

install.packages("RcppParallel", type = "source")
install.packages("StanHeaders", type = "source")
install.packages("rstan", type = "source")

```

---

<div class="post-metadata">

**Author:** ![dgomes](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/dgomes/32/10874_2.png) [@dgomes](https://discourse.mc-stan.org/u/dgomes)\
**Post date:** [March 8, 2021, 2:48am UTC](https://discourse.mc-stan.org/t/error-in-brms-compiling/16578/16 "2021-03-08T02:48:55Z")

</div>

Removing packages worked fine, but there were errors in installing from source (see attached .txt)

[SourceInstallErrors.txt](https://discourse.mc-stan.org/uploads/short-url/fWlrgyn7u0rxJWxSpO8tZ1unTPj.txt) (7.0 KB)

---

<div class="post-metadata">

**Author:** ![andrjohns](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/andrjohns/32/15297_2.png) [@andrjohns](https://discourse.mc-stan.org/u/andrjohns)\
**Post date:** [March 8, 2021, 2:57am UTC](https://discourse.mc-stan.org/t/error-in-brms-compiling/16578/17 "2021-03-08T02:57:56Z")

</div>

Try restarting R after uninstalling rstan, before installing RcppParallel

---

<div class="post-metadata">

**Author:** ![dgomes](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/dgomes/32/10874_2.png) [@dgomes](https://discourse.mc-stan.org/u/dgomes)\
**Post date:** [March 8, 2021, 3:57am UTC](https://discourse.mc-stan.org/t/error-in-brms-compiling/16578/18 "2021-03-08T03:57:29Z")

</div>

It looks like restarting R didn’t make a difference.  
I include the output here just in case I missed something. [SourceInstallErrors2.txt](https://discourse.mc-stan.org/uploads/short-url/mh3u5nD3MJrgVy5uXzYzxmkf7yi.txt) (7.1 KB)

---

<div class="post-metadata">

**Author:** ![andrjohns](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/andrjohns/32/15297_2.png) [@andrjohns](https://discourse.mc-stan.org/u/andrjohns)\
**Post date:** [March 8, 2021, 4:10am UTC](https://discourse.mc-stan.org/t/error-in-brms-compiling/16578/19 "2021-03-08T04:10:04Z")

</div>

Hmm, something’s a bit off there. For now just install the RcppParallel binary (`install.packages` as usual), and then install rstan and StanHeaders from source

---

<div class="post-metadata">

**Author:** ![dgomes](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/dgomes/32/10874_2.png) [@dgomes](https://discourse.mc-stan.org/u/dgomes)\
**Post date:** [March 8, 2021, 11:25pm UTC](https://discourse.mc-stan.org/t/error-in-brms-compiling/16578/20 "2021-03-08T23:25:31Z")

</div>

That allowed `RcppParallel` and `StanHeaders` to install, but still not `rstan` from source. The output is huge [rstan\_SourceInstall.txt](https://discourse.mc-stan.org/uploads/short-url/yj9cKHqr3FUCZawd41nxLcVqpd0.txt) (339.5 KB)

However, after installing the `rstan` binary and updating `rlang`, the Stan program is compiled when called from `brms::brm`.

Thank you so much for all your help Andrew.
