stan-dev / rstan

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

Compilation Error and #637 is not helpful #669

Open Tyhcass opened 5 years ago

Tyhcass commented 5 years ago

Summary:

After following #637, still received errors when attempting to run 8schools.stan.

Description:

Windows 7, R 3.5.3 rstan 2.18.2. Followed guidance and #637, but still got error for the simplest 8schools example.

Reproducible Steps:

sessionInfo() R version 3.5.3 (2019-03-11) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale: [1] LC_COLLATE=English_United States.1252 [2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

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

loaded via a namespace (and not attached): [1] compiler_3.5.3 tools_3.5.3 yaml_2.2.0

My Makevars.win looks as follows: CXX14=$(BINPREF)g++ -O2 -march=native -mtune=native CXX14FLAGS=-O3 -march=native -mtune=native CXX11FLAGS=-O3 -march=native -mtune=native

Sys.which("g++") "C:\Rtools\mingw_32\bin\G__~1.EXE"

Current Output:

fit <- stan(file = 'schools.stan', data = schools_dat) Error in compileCode(f, code, language = language, verbose = verbose) : Compilation ERROR, function(s)/method(s) not created! file1c8060ad4ca8.cpp:8:39: fatal error: stan/model/model_header.hpp: No such file or directory

include <stan/model/model_header.hpp>

^ compilation terminated. make: *** [C:/PROGRA~1/R/R-35~1.3/etc/x64/Makeconf:215: file1c8060ad4ca8.o] Error 1 In addition: Warning message: In system(cmd, intern = !verbose) : running command 'C:/PROGRA~1/R/R-35~1.3/bin/x64/R CMD SHLIB file1c8060ad4ca8.cpp 2> file1c8060ad4ca8.cpp.err.txt' had status 1 Error in sink(type = "output") : invalid connection

Expected Output:

Run 8schools example.

RStan Version:

2.18.2

R Version:

3.5.3

Operating System:

Windows 7 x64

jmh530 commented 5 years ago

I am also having this issue.

bgoodri commented 4 years ago

I would do

remove.packages(c("StanHeaders", "rstan"))
file.remove(".RData")

and then in a clean R session

install.packages("rstan", dependencies = TRUE)