I am using R on the Centos7 cluster, and successfully installed all the required packages including rstan and cmdstanr. First loaded the required modules:

```
module load gcc/8.3.0
module load R/4.0.3
module load gsl/2.6
R
```

and installed the required packages succesfully, and I tried the following models:

```
library(cmdstanr)
stan_program <- write_stan_tempfile("
parameters {
real x;
}
model {
real mu = -2;
x ~ normal(fabs(mu), 1);
}
"
)
mod <- cmdstan_model(stan_program)
fit <- mod$sample()
```

and

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

both of them worked fine and didn’t get any error. After all, I am trying to submit the job with bash script, but getting this compilation error.

```
mod <- cmdstan_model('model3.stan')
Compiling Stan program...
In file included from /share/builds/spack-compilers/opt/spack/linux-centos7-sandybridge/gcc-8.3.1/gcc-8.3.0-mnwujmnexs6zvenuhlu5m4io2om4sg55/include/c++/8.3.0/x86_64-pc-linux-gnu/bits/c++config.h:508,
from /share/builds/spack-compilers/opt/spack/linux-centos7-sandybridge/gcc-8.3.1/gcc-8.3.0-mnwujmnexs6zvenuhlu5m4io2om4sg55/include/c++/8.3.0/new:39,
from stan/lib/stan_math/lib/eigen_3.3.9/Eigen/Core:82,
from stan/lib/stan_math/lib/eigen_3.3.9/Eigen/Dense:1,
from stan/lib/stan_math/stan/math/prim/fun/Eigen.hpp:22,
from stan/lib/stan_math/stan/math/rev.hpp:4,
from stan/lib/stan_math/stan/math.hpp:19,
from stan/src/stan/model/model_header.hpp:4,
from /tmp/RtmpDzWg2n/model-5a62383c457c.hpp:3:
/share/builds/spack-compilers/opt/spack/linux-centos7-sandybridge/gcc-8.3.1/gcc-8.3.0-mnwujmnexs6zvenuhlu5m4io2om4sg55/include/c++/8.3.0/x86_64-pc-linux-gnu/bits/os_defines.h:39:10: fatal error: features.h: No such file or directory
#include <features.h>
^~~~~~~~~~~~
compilation terminated.
make: *** [/tmp/RtmpDzWg2n/model-5a62383c457c] Error 1
Error: An error occured during compilation! See the message above for more information.
Execution halted
```

If anybody can help with this, I would really appreciate it.

**I do not have admin rights.