Compile error

#1

Hi stan users,

I installed the rstan 2.18.2 following the instructions. However, there are always errors when compiling.

Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! In file included from C:/Program Files/R/R-3.5.3/library/BH/include/boost/random/detail/integer_log2.hpp:19:0,
from C:/Program Files/R/R-3.5.3/library/BH/include/boost/random/detail/int_float_pair.hpp:26,
from C:/Program Files/R/R-3.5.3/library/BH/include/boost/random/exponential_distribution.hpp:27,
from C:/Program Files/R/R-3.5.3/library/BH/include/boost/random/gamma_distribution.hpp:25,
from C:/Program Files/R/R-3.5.3/library/StanHeaders/include/stan/math/prim/mat/prob/dirichlet_rng.hpp:5,
from C:/Program Files/R/R-3.5.3/library/StanHeaders/include/stan/math/prim/mat.hpp:276,
from C:/Program Files/R/R-3.5.3/library/StanHeaders/include/stan/math/rev/mat.hpp:12,
from C:/Program Files/R/R-3.5.3/library/StanHeaders/include/stan/math.hpp:4,
from C:/Program Files/R/R-3.5.3/library/StanHeaders
In addition: Warning message:
In system(cmd, intern = !verbose) :
running command ‘C:/PROGRA~1/R/R-35~1.3/bin/x64/R CMD SHLIB file15cc6e2f1671.cpp 2> file15cc6e2f1671.cpp.err.txt’ had status 1
Error in sink(type = “output”) : invalid connection

How can I fix this problem?

Thanks.

0 Likes

#2

If you do something like

stancode <- 'data {real y_mean;} parameters {real y;} model {y ~ normal(y_mean,1);}'
mod <- stan_model(model_code = stancode, verbose = TRUE)

what is the string surrounding the word error: (with the colon) in the output?

0 Likes

#3

Thanks for your reply. I removed the following steps and it can run successfully.
Sys.setenv(LOCAL_CPPFLAGS = ‘-march=native’)
options(mc.cores = parallel::detectCores())

0 Likes