stan-dev / rstan

RStan, the R interface to Stan
https://mc-stan.org
1.04k stars 268 forks source link

Compilation ERROR, after successful install #566

Open datarichard opened 6 years ago

datarichard commented 6 years ago

Summary:

After following the instructions on https://github.com/stan-dev/rstan/wiki/Installing-RStan-on-Mac-or-Linux, I get a compile error when I try to run any of the demos or my own model.

Description:

After executing the demo, it downloads and begins to run, declaring variables etc. And then it stops and a long screen of text issues with the final error message shown below.

On my other mac the demo seems to run ok. Both macs have the same setup apart from the version of StanHeaders, which is 2.18.0 on the mac that fails, and 2.17.2 on the mac that works. I would like to install and test 2.17.2 on the problem mac but I don't know how to download and install an older version of StanHeaders.

Reproducible Steps:

install.packages("rstan", repos = "https://cloud.r-project.org/", dependencies=TRUE) library(rstan) stan_demo(461)

Current Output:

Error in compileCode(f, code, language = language, verbose = verbose) : Compilation ERROR, function(s)/method(s) not created! In file included from file9a17a1e3827.cpp:8: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/model/model_header.hpp:4: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math.hpp:4: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/mat.hpp:4: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/core.hpp:4: In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/core/autodiffstackstorage.hpp:4: /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/memory/stack_alloc.hpp:145:10: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions] for (auto& bloc In addition: Warning messages: 1: In stan_model(MODELS, model_name = model) : StanHeaders version is ahead of rstan version; update to latest rstan 2: In system(cmd, intern = !verbose) : running command '/Library/Frameworks/R.framework/Resources/bin/R CMD SHLIB file9a17a1e3827.cpp 2> file9a17a1e3827.cpp.err.txt' had status 1

Expected Output:

If applicable, the output you expected from RStan.

RStan Version:

The version of RStan you are running (e.g., from packageVersion("rstan")) ‘2.17.4’

R Version:

The version of R you are running (e.g., from R.version.string) "R version 3.5.1 (2018-07-02)"

Operating System:

Your operating system (e.g., OS X 10.11.3) macOS Mojave 10.14

datarichard commented 6 years ago

I figured out how to install StanHeaders version 2.17.2 from https://cran.r-project.org/src/contrib/Archive/StanHeaders/

packageurl <- "http://cran.r-project.org/src/contrib/Archive/StanHeaders/StanHeaders_2.17.2.tar.gz"
install.packages(packageurl, repos=NULL, type="source")

That seems to have fixed the error. The demo now runs as expected. However I'm left wondering why the latest version of StanHeaders doesn't run on my setup.

Hope that helps somehow...

bgoodri commented 6 years ago

StanHeaders 2.18 will only work with rstan 2.17 if you first call

Sys.setenv(USE_CXX14 = 1)

but this will be done internally once rstan 2.18.1 is approved by CRAN.

On Thu, Oct 11, 2018 at 4:24 AM Richard Morris notifications@github.com wrote:

I figured out how to install StanHeaders version 2.17.2 from https://cran.r-project.org/src/contrib/Archive/StanHeaders/

packageurl <- "http://cran.r-project.org/src/contrib/Archive/StanHeaders/StanHeaders_2.17.2.tar.gz" install.packages(packageurl, repos=NULL, type="source")

That seems to have fixed the error. The demo now runs as expected. However I'm left wondering why the latest version of StanHeaders doesn't run on my setup.

Hope that helps somehow...

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/stan-dev/rstan/issues/566#issuecomment-428865849, or mute the thread https://github.com/notifications/unsubscribe-auth/ADOrqqQ1jTmxKbO53Iig7cRUe3cBI3Nuks5ujwBGgaJpZM4XW88k .

statwonk commented 6 years ago

I'm using StanHeaders 2.18.0 and rstan of 2.17.3 and Sys.setenv(USE_CXX14 = 1) didn't solve things for me.

bgoodri commented 6 years ago

@statwonk Which error message are you getting?

surueSK commented 5 years ago

Maybe you should check this. https://github.com/RcppCore/Rcpp/issues/922 I had similar problems, but it solves when I do what coatless said.