I have code to specify a stan model using the brms package. This code works well when using RStudio without a project open. However, when I open an RStudio project, I receive an error when trying to compile the stan model:
Error in compileCode(f, code, language = language, verbose = verbose) :
In file included from <built-in>:1:In file included from /Users/jasper/Library/Caches/org.R-project.R/R/renv/cache/v5/R-4.2/aarch64-apple-darwin20/StanHeaders/2.21.0-7/0459d4dd7a8c239be18469a30c23dd4b/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13:In file included from /Users/jasper/Desktop/brms-test/renv/library/R-4.2/aarch64-apple-darwin20/RcppEigen/include/Eigen/Dense:1:/Users/jasper/Desktop/brms-test/renv/library/R-4.2/aarch64-apple-darwin20/RcppEigen/include/Eigen/Core:266:10: fatal error: 'omp.h' file not found#include <omp.h> ^~~~~~~1 error generated.make: *** [file200d5eaa7dc2.o] Error 1
Error in sink(type = "output") : invalid connection
I started with a fresh project, with only brms
(and its dependencies) installed, yet the issue persists.
I have updated R, RStudio and all packages to the latest version (both inside and outside the project), so this should not be an issue.
The fact that it can compile outside a project shows that I have installed clang
etc correctly.
I read that renv
uses its own Makevars, but it does not make a difference whether I download a binary, install from source using install.packages()
or renv::install()
.
I am using macOS 13.1 and R 4.2.2.
Could you help me?