# Issue compiling model in rstan

**URL:** <https://discourse.mc-stan.org/t/issue-compiling-model-in-rstan/2163>\
**Category:** General\
**Created:** [October 9, 2017, 8:49pm UTC](https://discourse.mc-stan.org/t/issue-compiling-model-in-rstan/2163 "2017-10-09T20:49:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmlakhan](https://avatars.discourse-cdn.com/v4/letter/c/278dde/32.png) [@cmlakhan](https://discourse.mc-stan.org/u/cmlakhan)\
**Post date:** [October 9, 2017, 8:49pm UTC](https://discourse.mc-stan.org/t/issue-compiling-model-in-rstan/2163/1 "2017-10-09T20:49:44Z")

</div>

I am trying to compile a model using rstan but I believe I am having a c++ compilation issue. This is the error message I got. I am also posting the g++ version and rstan versions that have been loaded below. Could someone help?

Error in compileCode(f, code, language = language, verbose = verbose) :  
Compilation ERROR, function(s)/method(s) not created! In file included from /opt/R-3.2.1/lib64/R/include/boost/config.hpp:39:0,  
from /opt/R-3.2.1/lib64/R/include/boost/math/tools/config.hpp:13,  
from /home/cl313/R/x86\_64-unknown-linux-gnu-library/3.2/StanHeaders/include/stan/math/rev/core/var.hpp:7,  
from /home/cl313/R/x86\_64-unknown-linux-gnu-library/3.2/StanHeaders/include/stan/math/rev/core/gevv\_vvv\_vari.hpp:5,  
from /home/cl313/R/x86\_64-unknown-linux-gnu-library/3.2/StanHeaders/include/stan/math/rev/core.hpp:12,  
from /home/cl313/R/x86\_64-unknown-linux-gnu-library/3.2/StanHeaders/include/stan/math/rev/mat.hpp:4,  
from /home/cl313/R/x86\_64-unknown-linux-gnu-library/3.2/StanHeaders/include/stan/math.hpp:4,  
from /home/cl313/R/x86\_64-unknown-linux-gnu-library/3.2/StanHeaders/include/src/stan/model/model\_header.hpp:4,  
from file1f865c24d33.cpp:8:  
/o  
In addition: Warning message:  
running command ‘/opt/R-3.2.1/lib64/R/bin/R CMD SHLIB file1f865c24d33.cpp 2\> file1f865c24d33.cpp.err.txt’ had status 1

Using built-in specs.  
COLLECT\_GCC=g++  
COLLECT\_LTO\_WRAPPER=/opt/gcc-5.2.0/libexec/gcc/x86\_64-unknown-linux-gnu/5.2.0/lto-wrapper  
Target: x86\_64-unknown-linux-gnu  
Configured with: …/configure --enable-shared --prefix=/opt/gcc-5.2.0 --disable-multilib --disable-bootstrap  
Thread model: posix  
gcc version 5.2.0 (GCC)

> sessionInfo()  
> R version 3.2.1 (2015-06-18)  
> Platform: x86\_64-unknown-linux-gnu (64-bit)  
> Running under: CentOS release 6.8 (Final)

locale:  
[1] LC\_CTYPE=en\_US.UTF-8 LC\_NUMERIC=C  
[3] LC\_TIME=en\_US.UTF-8 LC\_COLLATE=en\_US.UTF-8  
[5] LC\_MONETARY=en\_US.UTF-8 LC\_MESSAGES=en\_US.UTF-8  
[7] LC\_PAPER=en\_US.UTF-8 LC\_NAME=C  
[9] LC\_ADDRESS=C LC\_TELEPHONE=C  
[11] LC\_MEASUREMENT=en\_US.UTF-8 LC\_IDENTIFICATION=C

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

other attached packages:  
[1] dplyr\_0.7.2 readr\_1.1.1 rstan\_2.16.2  
[4] StanHeaders\_2.16.0-1 ggplot2\_2.2.1

loaded via a namespace (and not attached):  
[1] Rcpp\_0.12.13 assertthat\_0.2.0 R6\_2.2.2 grid\_3.2.1  
[5] plyr\_1.8.4 gtable\_0.2.0 magrittr\_1.5 stats4\_3.2.1  
[9] scales\_0.4.1 rlang\_0.1.2 lazyeval\_0.2.0 bindrcpp\_0.2  
[13] glue\_1.1.1 munsell\_0.4.3 hms\_0.3 parallel\_3.2.1  
[17] pkgconfig\_2.0.1 inline\_0.3.14 colorspace\_1.3-2 bindr\_0.1  
[21] gridExtra\_2.3 tibble\_1.3.3

---

<div class="post-metadata">

**Author:** ![bgoodri](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bgoodri/32/4451_2.png) [@bgoodri](https://discourse.mc-stan.org/u/bgoodri)\
**Post date:** [October 9, 2017, 9:26pm UTC](https://discourse.mc-stan.org/t/issue-compiling-model-in-rstan/2163/2 "2017-10-09T21:26:34Z")

</div>

There should be more to the error message. But it is usually making sure the the Rcpp package is compiled with the same setting as the Stan model. Also, the `COLLECT_LTO_WRAPPER` might be causing issues.

---

<div class="post-metadata">

**Author:** ![cmlakhan](https://avatars.discourse-cdn.com/v4/letter/c/278dde/32.png) [@cmlakhan](https://discourse.mc-stan.org/u/cmlakhan)\
**Post date:** [October 10, 2017, 4:34pm UTC](https://discourse.mc-stan.org/t/issue-compiling-model-in-rstan/2163/3 "2017-10-10T16:34:17Z")

</div>

I don’t know if this will be more helpful. If not that is okay, will just use PyStan as I am able to create a virtualenv and that seems to be okay for my purpose. My problem is that I am trying to run rstan in a computing cluster where I cannot update my packages so easily, which may be why this isn’t working.

In file included from /opt/R-3.2.1/lib64/R/include/boost/config.hpp:39:0,  
from /opt/R-3.2.1/lib64/R/include/boost/math/tools/config.hpp:13,  
from /home/cl313/R/x86\_64-unknown-linux-gnu-library/3.2/StanHeaders/include/stan/math/rev/core/var.hpp:7,  
from /home/cl313/R/x86\_64-unknown-linux-gnu-library/3.2/StanHeaders/include/stan/math/rev/core/gevv\_vvv\_vari.hpp:5,  
from /home/cl313/R/x86\_64-unknown-linux-gnu-library/3.2/StanHeaders/include/stan/math/rev/core.hpp:12,  
from /home/cl313/R/x86\_64-unknown-linux-gnu-library/3.2/StanHeaders/include/stan/math/rev/mat.hpp:4,  
from /home/cl313/R/x86\_64-unknown-linux-gnu-library/3.2/StanHeaders/include/stan/math.hpp:4,  
from /home/cl313/R/x86\_64-unknown-linux-gnu-library/3.2/StanHeaders/include/src/stan/model/model\_header.hpp:4,  
from file4bb149396776.cpp:8:  
/opt/R-3.2.1/lib64/R/include/boost/config/compiler/gcc.hpp:160:0: warning: “BOOST\_NO\_CXX11\_RVALUE\_REFERENCES” redefined

# define BOOST\_NO\_CXX11\_RVALUE\_REFERENCES

^  
:0:0: note: this is the location of the previous definition  
In file included from /home/cl313/R/x86\_64-unknown-linux-gnu-library/3.2/StanHeaders/include/stan/math/prim/arr.hpp:38:0,  
from /home/cl313/R/x86\_64-unknown-linux-gnu-library/3.2/StanHeaders/include/stan/math/prim/mat.hpp:298,  
from /home/cl313/R/x86\_64-unknown-linux-gnu-library/3.2/StanHeaders/include/stan/math/rev/mat.hpp:12,  
from /home/cl313/R/x86\_64-unknown-linux-gnu-library/3.2/StanHeaders/include/stan/math.hpp:4,  
from /home/cl313/R/x86\_64-unknown-linux-gnu-library/3.2/StanHeaders/include/src/stan/model/model\_header.hpp:4,  
from file4bb149396776.cpp:8:  
/home/cl313/R/x86\_64-unknown-linux-gnu-library/3.2/StanHeaders/include/stan/math/prim/arr/functor/integrate\_ode\_rk45.hpp: In function ‘std::vector\<std::vector\<typename stan::return\_type\<T\_y, T\_loc\>::type\> \> stan::math::integrate\_ode\_rk45(const F&, std::vector, double, const std::vector&, const std::vector&, const std::vector&, const std::vector&, std::ostream\*, double, double, int)’:  
/home/cl313/R/x86\_64-unknown-linux-gnu-library/3.2/StanHeaders/include/stan/math/prim/arr/functor/integrate\_ode\_rk45.hpp:80:37: error: ‘boost::numeric::odeint::max\_step\_checker’ has not been declared  
using boost::numeric::odeint::max\_step\_checker;  
^  
/home/cl313/R/x86\_64-unknown-linux-gnu-library/3.2/StanHeaders/include/stan/math/prim/arr/functor/integrate\_ode\_rk45.hpp:135:53: error: there are no arguments to ‘max\_step\_checker’ that depend on a template parameter, so a declaration of ‘max\_step\_checker’ must be available [-fpermissive]  
max\_step\_checker(max\_num\_steps));  
^  
/home/cl313/R/x86\_64-unknown-linux-gnu-library/3.2/StanHeaders/include/stan/math/prim/arr/functor/integrate\_ode\_rk45.hpp:135:53: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)  
make: \*\*\* [file4bb149396776.o] Error 1

ERROR(s) during compilation: source code errors or compiler configuration errors!
