Cmdstan building error in Windows

Hello,

I am running into problems trying to install cmdstan on my Windows 10 PC. From what I can tell, it is not finding files that it is expecting to find. Below is the output:


C:\Program Files\MATLAB\R2020a\toolbox\ERA_Toolbox\ERA_Toolbox-master\ERADependents\cmdstan-2.25.0>mingw32-make build
cd stan/lib/stan_math/lib/boost_1.72.0; ./bootstrap.bat gcc
Building Boost.Build engine

Generating Boost.Build configuration in project-config.jam for gcc…

Bootstrapping is done. To build, run:

.\b2

To adjust configuration, edit ‘project-config.jam’.
Further information:

- Command line help:
.\b2 --help

- Getting started guide:
http://boost.org/more/getting_started/windows.html

- Boost.Build documentation:
http://www.boost.org/build/

cd stan/lib/stan_math/lib/boost_1.72.0; ./b2 address-model=64 --visibility=hidden --with-program_options cxxstd=11 variant=release link=static
Performing configuration checks

- default address-model    : 64-bit (cached)
- default architecture     : x86 (cached)

Building the Boost C++ Libraries.

Component configuration:

- atomic                   : not building
- chrono                   : not building
- container                : not building
- context                  : not building
- contract                 : not building
- coroutine                : not building
- date_time                : not building
- exception                : not building
- fiber                    : not building
- filesystem               : not building
- graph                    : not building
- graph_parallel           : not building
- headers                  : not building
- iostreams                : not building
- locale                   : not building
- log                      : not building
- math                     : not building
- mpi                      : not building
- program_options          : building
- python                   : not building
- random                   : not building
- regex                    : not building
- serialization            : not building
- stacktrace               : not building
- system                   : not building
- test                     : not building
- thread                   : not building
- timer                    : not building
- type_erasure             : not building
- wave                     : not building

…patience…
…found 1075 targets…
…updating 11 targets…
gcc.compile.c++ bin.v2\libs\program_options\build\gcc-4.9.3\release\cxxstd-11-iso\link-static\threading-multi\visibility-hidden\positional_options.o
Assembler messages:
Fatal error: can’t create bin.v2\libs\program_options\build\gcc-4.9.3\release\cxxstd-11-iso\link-static\threading-multi\visibility-hidden\positional_options.o: No such file or directory

"g++"   -std=c++11 -fvisibility-inlines-hidden -m64 -mthreads -O3 -finline-functions -Wno-inline -Wall -fvisibility=hidden  -DBOOST_ALL_NO_LIB=1 -DNDEBUG  -I"." -c -o "bin.v2\libs\program_options\build\gcc-4.9.3\release\cxxstd-11-iso\link-static\threading-multi\visibility-hidden\positional_options.o" "libs\program_options\src\positional_options.cpp"

…failed gcc.compile.c++ bin.v2\libs\program_options\build\gcc-4.9.3\release\cxxstd-11-iso\link-static\threading-multi\visibility-hidden\positional_options.o…
gcc.compile.c++ bin.v2\libs\program_options\build\gcc-4.9.3\release\cxxstd-11-iso\link-static\threading-multi\visibility-hidden\utf8_codecvt_facet.o
Assembler messages:
Fatal error: can’t create bin.v2\libs\program_options\build\gcc-4.9.3\release\cxxstd-11-iso\link-static\threading-multi\visibility-hidden\utf8_codecvt_facet.o: No such file or directory

"g++"   -std=c++11 -fvisibility-inlines-hidden -m64 -mthreads -O3 -finline-functions -Wno-inline -Wall -fvisibility=hidden  -DBOOST_ALL_NO_LIB=1 -DNDEBUG  -I"." -c -o "bin.v2\libs\program_options\build\gcc-4.9.3\release\cxxstd-11-iso\link-static\threading-multi\visibility-hidden\utf8_codecvt_facet.o" "libs\program_options\src\utf8_codecvt_facet.cpp"

…failed gcc.compile.c++ bin.v2\libs\program_options\build\gcc-4.9.3\release\cxxstd-11-iso\link-static\threading-multi\visibility-hidden\utf8_codecvt_facet.o…
gcc.compile.c++ bin.v2\libs\program_options\build\gcc-4.9.3\release\cxxstd-11-iso\link-static\threading-multi\visibility-hidden\config_file.o
Assembler messages:
Fatal error: can’t create bin.v2\libs\program_options\build\gcc-4.9.3\release\cxxstd-11-iso\link-static\threading-multi\visibility-hidden\config_file.o: No such file or directory

"g++"   -std=c++11 -fvisibility-inlines-hidden -m64 -mthreads -O3 -finline-functions -Wno-inline -Wall -fvisibility=hidden  -DBOOST_ALL_NO_LIB=1 -DNDEBUG  -I"." -c -o "bin.v2\libs\program_options\build\gcc-4.9.3\release\cxxstd-11-iso\link-static\threading-multi\visibility-hidden\config_file.o" "libs\program_options\src\config_file.cpp"

…failed gcc.compile.c++ bin.v2\libs\program_options\build\gcc-4.9.3\release\cxxstd-11-iso\link-static\threading-multi\visibility-hidden\config_file.o…
gcc.compile.c++ bin.v2\libs\program_options\build\gcc-4.9.3\release\cxxstd-11-iso\link-static\threading-multi\visibility-hidden\variables_map.o
Assembler messages:
Fatal error: can’t create bin.v2\libs\program_options\build\gcc-4.9.3\release\cxxstd-11-iso\link-static\threading-multi\visibility-hidden\variables_map.o: No such file or directory

"g++"   -std=c++11 -fvisibility-inlines-hidden -m64 -mthreads -O3 -finline-functions -Wno-inline -Wall -fvisibility=hidden  -DBOOST_ALL_NO_LIB=1 -DNDEBUG  -I"." -c -o "bin.v2\libs\program_options\build\gcc-4.9.3\release\cxxstd-11-iso\link-static\threading-multi\visibility-hidden\variables_map.o" "libs\program_options\src\variables_map.cpp"

…failed gcc.compile.c++ bin.v2\libs\program_options\build\gcc-4.9.3\release\cxxstd-11-iso\link-static\threading-multi\visibility-hidden\variables_map.o…
gcc.compile.c++ bin.v2\libs\program_options\build\gcc-4.9.3\release\cxxstd-11-iso\link-static\threading-multi\visibility-hidden\value_semantic.o
Assembler messages:
Fatal error: can’t create bin.v2\libs\program_options\build\gcc-4.9.3\release\cxxstd-11-iso\link-static\threading-multi\visibility-hidden\value_semantic.o: No such file or directory

"g++"   -std=c++11 -fvisibility-inlines-hidden -m64 -mthreads -O3 -finline-functions -Wno-inline -Wall -fvisibility=hidden  -DBOOST_ALL_NO_LIB=1 -DNDEBUG  -I"." -c -o "bin.v2\libs\program_options\build\gcc-4.9.3\release\cxxstd-11-iso\link-static\threading-multi\visibility-hidden\value_semantic.o" "libs\program_options\src\value_semantic.cpp"

…failed gcc.compile.c++ bin.v2\libs\program_options\build\gcc-4.9.3\release\cxxstd-11-iso\link-static\threading-multi\visibility-hidden\value_semantic.o…
gcc.compile.c++ bin.v2\libs\program_options\build\gcc-4.9.3\release\cxxstd-11-iso\link-static\threading-multi\visibility-hidden\options_description.o
Assembler messages:
Fatal error: can’t create bin.v2\libs\program_options\build\gcc-4.9.3\release\cxxstd-11-iso\link-static\threading-multi\visibility-hidden\options_description.o: No such file or directory

"g++"   -std=c++11 -fvisibility-inlines-hidden -m64 -mthreads -O3 -finline-functions -Wno-inline -Wall -fvisibility=hidden  -DBOOST_ALL_NO_LIB=1 -DNDEBUG  -I"." -c -o "bin.v2\libs\program_options\build\gcc-4.9.3\release\cxxstd-11-iso\link-static\threading-multi\visibility-hidden\options_description.o" "libs\program_options\src\options_description.cpp"

…failed gcc.compile.c++ bin.v2\libs\program_options\build\gcc-4.9.3\release\cxxstd-11-iso\link-static\threading-multi\visibility-hidden\options_description.o…
…skipped <pbin.v2\libs\program_options\build\gcc-4.9.3\release\cxxstd-11-iso\link-static\threading-multi\visibility-hidden>libboost_program_options-mgw49-mt-x64-1_72.a(clean) for lack of <pbin.v2\libs\program_options\build\gcc-4.9.3\release\cxxstd-11-iso\link-static\threading-multi\visibility-hidden>config_file.o…
…skipped <pbin.v2\libs\program_options\build\gcc-4.9.3\release\cxxstd-11-iso\link-static\threading-multi\visibility-hidden>libboost_program_options-mgw49-mt-x64-1_72.a for lack of <pbin.v2\libs\program_options\build\gcc-4.9.3\release\cxxstd-11-iso\link-static\threading-multi\visibility-hidden>config_file.o…
…skipped <pC:\Program Files\MATLAB\R2020a\toolbox\ERA_Toolbox\ERA_Toolbox-master\ERADependents\cmdstan-2.25.0\stan\lib\stan_math\lib\boost_1.72.0\stage\lib>libboost_program_options-mgw49-mt-x64-1_72.a for lack of <pbin.v2\libs\program_options\build\gcc-4.9.3\release\cxxstd-11-iso\link-static\threading-multi\visibility-hidden>libboost_program_options-mgw49-mt-x64-1_72.a…
…skipped <pbin.v2\libs\program_options\build\gcc-4.9.3\release\cxxstd-11-iso\link-static\threading-multi\visibility-hidden>libboost_program_options-variant-mgw49-mt-x64-1_72-static.cmake for lack of <pbin.v2\libs\program_options\build\gcc-4.9.3\release\cxxstd-11-iso\link-static\threading-multi\visibility-hidden>libboost_program_options-mgw49-mt-x64-1_72.a…
…skipped <pC:\Program Files\MATLAB\R2020a\toolbox\ERA_Toolbox\ERA_Toolbox-master\ERADependents\cmdstan-2.25.0\stan\lib\stan_math\lib\boost_1.72.0\stage\lib\cmake\boost_program_options-1.72.0>libboost_program_options-variant-mgw49-mt-x64-1_72-static.cmake for lack of <pbin.v2\libs\program_options\build\gcc-4.9.3\release\cxxstd-11-iso\link-static\threading-multi\visibility-hidden>libboost_program_options-variant-mgw49-mt-x64-1_72-static.cmake…
…failed updating 6 targets…
…skipped 5 targets…
make/command:38: recipe for target ‘stan/lib/stan_math/lib/boost_1.72.0/stage/lib/libboost_program_options*.a’ failed
mingw32-make: *** [stan/lib/stan_math/lib/boost_1.72.0/stage/lib/libboost_program_options*.a] Error 1

I extracted the cmdstan-2.25.0 tar, so I’m not sure why it’s not finding the files. My g++ version is 4.9.3. and my make version is 4.2.1.

I really appreciate any help you all can offer!

Thanks,
Ricky

Hi,

are you using the RTools 3.5 supplied g++?

Make sure you have
C:/Rtools/bin
and
C:/Rtools/mingw_64/bin
in your PATH and that they are listed first (or at least before any other compilers you may have installed).

You can make sure which g++ is picked up by running

Get-Command g++

CommandType Name Version Source


Application g++.exe 0.0.0.0 C:\Rtools\mingw_64\bin\g++.exe

The first one listed should be the RTools one (if you are using it). Same goes for
Get-Command mingw32-make

Hello,

Thank you for the help! The Get-Command revealed that it was pointing to a different g++ compiler, even though I did have the path variable set correctly. I reset everything and then it pointed to the correct RTools g++ compiler. Unfortunately, I still got the same error. However, I tried placing the cmdstan files in a new directory because I thought the problem may be that it was in Program Files, and perhaps having a space in the directory path messed with things. Turns out that must have been the issue because everything installed perfectly - thanks for the quick reply!

-Ricky

1 Like

Yeah, paths in spaces can be tricky. The other problem might be permissions (you need to confirm elevated permission in Program File usually). Glad its working.