Cannot install CmdStan >2.16.0 on Windows machine

Hello,
since I would like to benefit from the advantages using Stan 2.19.1, today I tried to install this version on my Windows 7 machine. So far, only 2.16.0 was compiled successfully and I was not able to install 2.17 or 2.18 before.

Rtools34 is installed.
PATH is set to c:\Rtools\bin;C:\Rtools\mingw_64;C:\Rtools\gcc-4.6.3\bin;...

When I try to build 2.19.1, I get the following message:
make build

g++ -std=c++1y -m64 -Wall -Wno-unused-function -Wno-uninitialized -Wno-unused-bu
t-set-variable -Wno-unused-variable -Wno-sign-compare -Wno-unused-local-typedefs
-O3 -I src -I stan/src -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eig
en_3.3.3 -I stan/lib/stan_math/lib/boost_1.69.0 -I stan/lib/stan_math/lib/sundia
ls_4.1.0/include  -D_USE_MATH_DEFINES  -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECL
TYPE -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION     -c -MT s
rc/cmdstan/stanc.o -M -E -MG -MP -MF src/cmdstan/stanc.d src/cmdstan/stanc.cpp
cc1plus.exe: error: unrecognized command line option '-std=c++1y'
cc1plus.exe: warning: unrecognized command line option "-Wno-unused-local-typede
fs" [enabled by default]
make: *** [src/cmdstan/stanc.d] Error 1

So far, I was not able to localize the issue and I would really appreciate your help.
Regards!

Hi,

You need to update your C++ compiler

2.17 (or was it 2.18) needs support for C++11 and 2.19 needs support for C++1y (C++14 and newer).

If you follow instructions in CmdStan guide (Install/Windows) you should be able to install the latest release on Windows. https://github.com/stan-dev/cmdstan/releases/download/v2.19.1/cmdstan-guide-2.19.1.pdf

@seantalts is RTools35 fine or do users need to use RTools40

https://cran.r-project.org/bin/windows/Rtools/

1 Like

3.5 is fine.

Thanks four your replies.
I deinstalled all former versions of Rtools, afterwards I installed Rtools35.
Now, Path looks like:
PATH=c:\Rtools\bin;C:\Rtools\mingw_64;...

For Rtool35, I cannot find something like
c:\Rtools\gcc-4.6.3\bin as given in the manual.

Still no success:
I just show you the last error message (there are much more indeed)

g++ -std=c++1y -m64 -Wall -Wno-unused-function -Wno-uninitialized -Wno-unused-bu
t-set-variable -Wno-unused-variable -Wno-sign-compare -Wno-unused-local-typedefs
-O3 -I src -I stan/src -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eig
en_3.3.3 -I stan/lib/stan_math/lib/boost_1.69.0 -I stan/lib/stan_math/lib/sundia
ls_4.1.0/include  -D_USE_MATH_DEFINES  -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECL
TYPE -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION     -c -o bi
n/cmdstan/stanc.o src/cmdstan/stanc.cpp
make: g++: Command not found
make: *** [make/command:3: bin/cmdstan/stanc.o] Error 127

Probably, I need a newer version of gcc, but I don’t know where I can get one.

1 Like

I’m able to make CmdStan with the following:
PATH=c:\Rtools\bin;C:\Rtools\mingw_64\bin
the additional \bin after \mingw_64\ enabled the success.

However, I’m not able to compile a modell now via MatlabStan:

We have to compile the model first...
compile: --- Translating Stan model to C++ code ---
compile: bin'\'stanc.exe  C:/Users/anon_model.stan --o=C:/Users/anon_model.hpp
compile: Model name=anon_model_model
compile: Input file=C:/Users/anon_model.stan
compile: Output file=C:/Users/anon_model.hpp
compile: make: g++: Command not found
compile: make: *** [makefile:77: C:/Users/anon_model.exe] Error 127
compile: --- Linking C++ model ---
compile: g++ -I src -I stan/src -isystem stan/lib/stan_math/ -isystem stan/lib/stan_math/lib/eigen_3.3.3 -isystem stan/lib/stan_math/lib/boost_1.62.0 -isystem stan/lib/stan_math/lib/cvodes_2.9.0/include -Wall -DEIGEN_NO_DEBUG  -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DFUSION_MAX_VECTOR_SIZE=12 -DNO_FPRINTF_OUTPUT -pipe  -m64 -Wno-unused-function -Wno-uninitialized -Wno-unused-but-set-variable    -O3 -o C:/Users/anon_model.exe src/cmdstan/main.cpp -include C:/Users/anon_model.hpp -include C:/Users/USER_HEADER.hpp stan/lib/stan_math/lib/cvodes_2.9.0/lib/libsundials_nvecserial.a stan/lib/stan_math/lib/cvodes_2.9.0/lib/libsundials_cvodes.a  -static-libgcc -static-libstdc++
Compile failed with exit value: 2

Okay, now it seems to work.
Don’t know why, but I reinstalled Rtools again and restarted Matlab and now everything seems to be fine.

If someone else faces this issue:
For me, Rtool35 and PATH=c:\Rtools\bin;C:\Rtools\mingw_64\bin worked.

Regards.

2 Likes