Issue compiling model in rstan


#1

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


#2

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.


#3

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!